mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 15:53:36 +00:00
Minor rename
This commit is contained in:
@@ -21,9 +21,9 @@ package io.vertx.core;
|
||||
public interface Closeable {
|
||||
|
||||
/**
|
||||
* Close this resource, the {@code completionHandler} must be notified when the operation has completed.
|
||||
* Close this resource, the {@code completion} promise must be notified when the operation has completed.
|
||||
*
|
||||
* @param completionHandler the handler to notify when close has completed
|
||||
* @param completion the promise to signal when close has completed
|
||||
*/
|
||||
void close(Promise<Void> completionHandler);
|
||||
void close(Promise<Void> completion);
|
||||
}
|
||||
|
||||
@@ -479,8 +479,8 @@ public class EventBusImpl implements EventBus, MetricsProvider {
|
||||
}
|
||||
|
||||
// Called by context on undeploy
|
||||
public void close(Promise<Void> completionHandler) {
|
||||
handler.unregister(completionHandler);
|
||||
public void close(Promise<Void> completion) {
|
||||
handler.unregister(completion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -336,13 +336,13 @@ public class HttpServerImpl implements HttpServer, Closeable, MetricsProvider {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void close(Promise<Void> done) {
|
||||
public synchronized void close(Promise<Void> completion) {
|
||||
if (wsStream.endHandler() != null || requestStream.endHandler() != null) {
|
||||
Handler<Void> wsEndHandler = wsStream.endHandler();
|
||||
wsStream.endHandler(null);
|
||||
Handler<Void> requestEndHandler = requestStream.endHandler();
|
||||
requestStream.endHandler(null);
|
||||
done.future().setHandler(ar -> {
|
||||
completion.future().setHandler(ar -> {
|
||||
if (wsEndHandler != null) {
|
||||
wsEndHandler.handle(null);
|
||||
}
|
||||
@@ -354,7 +354,7 @@ public class HttpServerImpl implements HttpServer, Closeable, MetricsProvider {
|
||||
|
||||
ContextInternal context = vertx.getOrCreateContext();
|
||||
if (!listening) {
|
||||
executeCloseDone(context, done, null);
|
||||
executeCloseDone(context, completion, null);
|
||||
return;
|
||||
}
|
||||
listening = false;
|
||||
@@ -374,17 +374,17 @@ public class HttpServerImpl implements HttpServer, Closeable, MetricsProvider {
|
||||
|
||||
if (actualServer.httpHandlerMgr.hasHandlers()) {
|
||||
// The actual server still has handlers so we don't actually close it
|
||||
if (done != null) {
|
||||
executeCloseDone(context, done, null);
|
||||
if (completion != null) {
|
||||
executeCloseDone(context, completion, null);
|
||||
}
|
||||
} else {
|
||||
// No Handlers left so close the actual server
|
||||
// The done handler needs to be executed on the context that calls close, NOT the context
|
||||
// of the actual server
|
||||
actualServer.actualClose(context, done);
|
||||
actualServer.actualClose(context, completion);
|
||||
}
|
||||
} else {
|
||||
executeCloseDone(context, done, null);
|
||||
executeCloseDone(context, completion, null);
|
||||
}
|
||||
}
|
||||
if (creatingContext != null) {
|
||||
|
||||
@@ -971,11 +971,11 @@ public class VertxImpl implements VertxInternal, MetricsProvider {
|
||||
}
|
||||
|
||||
// Called via Context close hook when Verticle is undeployed
|
||||
public void close(Promise<Void> completionHandler) {
|
||||
public void close(Promise<Void> completion) {
|
||||
if (timeouts.remove(timerID) != null) {
|
||||
future.cancel(false);
|
||||
}
|
||||
completionHandler.complete();
|
||||
completion.complete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class WorkerExecutorImpl implements MetricsProvider, WorkerExecutorInternal {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(Promise<Void> completionHandler) {
|
||||
public void close(Promise<Void> completion) {
|
||||
synchronized (this) {
|
||||
if (!closed) {
|
||||
closed = true;
|
||||
@@ -85,6 +85,6 @@ class WorkerExecutorImpl implements MetricsProvider, WorkerExecutorInternal {
|
||||
pool.release();
|
||||
}
|
||||
}
|
||||
completionHandler.complete();
|
||||
completion.complete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,17 +360,17 @@ public class NetServerImpl implements Closeable, MetricsProvider, NetServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void close(Promise<Void> completionHandler) {
|
||||
public synchronized void close(Promise<Void> completion) {
|
||||
if (creatingContext != null) {
|
||||
creatingContext.removeCloseHook(this);
|
||||
}
|
||||
Handler<Void> handler = endHandler;
|
||||
if (endHandler != null) {
|
||||
endHandler = null;
|
||||
completionHandler.future().setHandler(ar -> handler.handle(null));
|
||||
completion.future().setHandler(ar -> handler.handle(null));
|
||||
}
|
||||
if (!listening) {
|
||||
completionHandler.complete();
|
||||
completion.complete();
|
||||
return;
|
||||
}
|
||||
listening = false;
|
||||
@@ -381,15 +381,15 @@ public class NetServerImpl implements Closeable, MetricsProvider, NetServer {
|
||||
|
||||
if (actualServer.handlerManager.hasHandlers()) {
|
||||
// The actual server still has handlers so we don't actually close it
|
||||
completionHandler.complete();
|
||||
completion.complete();
|
||||
} else {
|
||||
// No Handlers left so close the actual server
|
||||
// The done handler needs to be executed on the context that calls close, NOT the context
|
||||
// of the actual server
|
||||
actualServer.actualClose(completionHandler);
|
||||
actualServer.actualClose(completion);
|
||||
}
|
||||
} else {
|
||||
completionHandler.complete();
|
||||
completion.complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,11 +55,11 @@ public class VertxTest extends AsyncTestBase {
|
||||
AtomicInteger closedCount = new AtomicInteger();
|
||||
class Hook implements Closeable {
|
||||
@Override
|
||||
public void close(Promise<Void> completionHandler) {
|
||||
public void close(Promise<Void> completion) {
|
||||
if (closedCount.incrementAndGet() == 1) {
|
||||
throw new RuntimeException();
|
||||
} else {
|
||||
completionHandler.handle(Future.succeededFuture());
|
||||
completion.handle(Future.succeededFuture());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,12 +80,12 @@ public class VertxTest extends AsyncTestBase {
|
||||
AtomicInteger closedCount = new AtomicInteger();
|
||||
class Hook implements Closeable {
|
||||
@Override
|
||||
public void close(Promise<Void> completionHandler) {
|
||||
public void close(Promise<Void> completion) {
|
||||
if (closedCount.incrementAndGet() == 1) {
|
||||
completionHandler.handle(Future.succeededFuture());
|
||||
completion.handle(Future.succeededFuture());
|
||||
throw new RuntimeException();
|
||||
} else {
|
||||
completionHandler.handle(Future.succeededFuture());
|
||||
completion.handle(Future.succeededFuture());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user