Vertx#close Future will not callback the handler - closes #3232

This commit is contained in:
Julien Viet
2019-12-16 16:26:14 +01:00
parent 2b78689ad3
commit cf6c864a2a
2 changed files with 13 additions and 1 deletions

View File

@@ -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();
}

View File

@@ -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();
}
}