@Override
public void close()
{
clientPool.close( ar -> {
if( ar.succeeded() ) {
LOGGER.info( "Closing db client pool." );
} else {
LOGGER.error( "...failed to close the database connection pool: ", ar.cause() );
}
} );
}
If I run with an attached debugger on the 'closing db pool' statement, I can see the code path is executed. However, no log message is output the my appenders.
In my main verticle that deploys my other verticles, I have defined a shutdown hook handler and see this logs to my appenders:
private final class ShutdownHook extends Thread
{
@Override
public void run()
{
LOGGER.info( "\nShutdown hook invoked." );
}
}
private void launchVerticles( String[] args )
{
Launcher launcher = new Launcher();
ArrayList<String> argList = new ArrayList<>();
argList.add( "run" );
argList.add( MainVerticle.class.getName() );
argList.addAll( 1, Arrays.asList( args ) );
launcher.dispatch( argList.toArray( new String[0] ) );
Runtime.getRuntime().addShutdownHook( new ShutdownHook() );
}
but like my other verticles, this one does not log:
@Override
public void stop()
throws Exception
{
vertx.deploymentIDs().forEach( vertx::rxUndeploy );
LOGGER.info( "Shutting down {}", getClass().getSimpleName() );
}
I added the shutdown hook and loggers to the stop() methods to better understand the shutdown flow. So one question I have is whether I need a shutdown hook when I'm delegating to the Launcher, or is there a shutdown hook that it registers, i.e., do I need to undeploy my verticles in my main verticle? Other question is whether I should be able to use a logger reference in my stop() methods or must I use stdout?
Thanks,
Robin