mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 08:51:19 +00:00
Async undeploy won't report exception by the verticle with promise complete - closes #3075
This commit is contained in:
@@ -668,7 +668,9 @@ public class DeploymentManager {
|
||||
try {
|
||||
verticleHolder.verticle.stop(stopPromise);
|
||||
} catch (Throwable t) {
|
||||
stopPromise.fail(t);
|
||||
if (!stopPromise.tryFail(t)) {
|
||||
undeployingContext.reportException(t);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -877,6 +877,7 @@ public class DeploymentTest extends VertxTestBase {
|
||||
await();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAsyncUndeployCalledSynchronously() throws Exception {
|
||||
MyAsyncVerticle verticle = new MyAsyncVerticle(f -> f.complete(null), f -> f.complete(null));
|
||||
@@ -943,6 +944,29 @@ public class DeploymentTest extends VertxTestBase {
|
||||
await();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsyncUndeployFailsAfterSuccess() {
|
||||
waitFor(2);
|
||||
Verticle verticle = new AbstractVerticle() {
|
||||
@Override
|
||||
public void stop(Promise<Void> stopPromise) throws Exception {
|
||||
stopPromise.complete();
|
||||
throw new Exception();
|
||||
}
|
||||
};
|
||||
Context ctx = vertx.getOrCreateContext();
|
||||
ctx.runOnContext(v1 -> {
|
||||
vertx.deployVerticle(verticle, onSuccess(id -> {
|
||||
ctx.exceptionHandler(err -> {
|
||||
complete();
|
||||
});
|
||||
vertx.undeploy(id, onSuccess(v2 -> {
|
||||
complete();
|
||||
}));
|
||||
}));
|
||||
});
|
||||
await();
|
||||
}
|
||||
@Test
|
||||
public void testChildUndeployedDirectly() throws Exception {
|
||||
Verticle parent = new AbstractVerticle() {
|
||||
|
||||
Reference in New Issue
Block a user