mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 08:51:19 +00:00
Vertx#close Future will not callback the handler - closes #3232
This commit is contained in:
@@ -478,7 +478,8 @@ public class VertxImpl implements VertxInternal, MetricsProvider {
|
||||
|
||||
@Override
|
||||
public Future<Void> close() {
|
||||
Promise<Void> promise = getOrCreateContext().promise();
|
||||
// Create this promise purposely without a context because the close operation will close thread pools
|
||||
Promise<Void> promise = Promise.promise();
|
||||
close(promise);
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
@@ -100,4 +100,15 @@ public class VertxTest extends AsyncTestBase {
|
||||
});
|
||||
await();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCloseFuture() throws Exception {
|
||||
Vertx vertx = Vertx.vertx();
|
||||
Future<Void> fut = vertx.close();
|
||||
// Check that we can get a callback on the future as thread pools are closed by the operation
|
||||
fut.onComplete(onSuccess(v -> {
|
||||
testComplete();
|
||||
}));
|
||||
await();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user