Orderly shutdown using vertx.close() and Verticle.stop()

1,105 views
Skip to first unread message

Stephan Wissel

unread,
Mar 17, 2016, 2:46:33 AM3/17/16
to vert.x
I'm wondering if I understand the right sequence for "orderly shutdown". I have a simple verticle that has the following stop() method:

@Override
  public void stop(Future<Void> stopFuture) throws Exception {
    System.out.println("Bye future from "+this.getClass().getName());
    stopFuture.complete();
  }

when I undeploy that using vertx.undeploy(verticleid), the stop function gets called as expected. However when I call vertx.close() either from inside (single verticle) or outside (verticle deployed in code), the stop() function doesn't seem to run.

Now wondering: How can I execute an orderly shutdown where all stop() functions are called properly? My working approach would be:

Have a base verticle that doesn't need a stop() function and let it undeploy all the others

Julien Viet

unread,
Mar 17, 2016, 4:36:01 AM3/17/16
to ve...@googlegroups.com
have you tried closing vertx with close(Handler<Void> completionHandmer) and block until the close method is finished ?

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/ecbadf84-1091-4ae1-b962-58bec5bdd87d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stephan Wissel

unread,
Mar 19, 2016, 3:44:11 AM3/19/16
to vert.x
Yes. Tried as suggested. When I call
vertx.close( result -> {
if(result.succeeded()) {
System.out.println("He's dead Jim");
}});

The message gets printed, but none of the debug statements in the stop(future) events (or the debugger stopping there);

My workaround for now is a shutdown() function that unloads all vertices my app has loaded

Tim Fox

unread,
Mar 19, 2016, 4:14:12 AM3/19/16
to ve...@googlegroups.com
Do you have a reproducer?
Reply all
Reply to author
Forward
0 new messages