use of com.nike.riposte.server.hooks.ServerShutdownHook in project riposte by Nike-Inc.
the class Server method shutdown.
public void shutdown() throws InterruptedException {
try {
logger.info("Shutting down Riposte...");
List<ChannelFuture> channelCloseFutures = new ArrayList<>();
for (Channel ch : channels) {
// execute shutdown hooks
if (serverConfig.serverShutdownHooks() != null) {
for (ServerShutdownHook hook : serverConfig.serverShutdownHooks()) {
hook.executeServerShutdownHook(serverConfig, ch);
}
}
channelCloseFutures.add(ch.close());
}
for (ChannelFuture chf : channelCloseFutures) {
chf.sync();
}
} finally {
eventLoopGroups.forEach(EventExecutorGroup::shutdownGracefully);
logger.info("...Riposte shutdown complete");
}
}
Aggregations