Skip to content

Commit

Permalink
Fix sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
amanteaux committed Oct 20, 2023
1 parent dbd0b25 commit 82a2907
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/com/coreoz/WebApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@ public static void main(String[] args) {
}
}


private static void addShutDownListener(HttpServer httpServer, Scheduler scheduler) {
Runtime.getRuntime().addShutdownHook(new Thread(
() -> {
logger.info("Stopping signal received, shutting down server and scheduler...");
GrizzlyFuture<HttpServer> grizzlyServerShutdownFuture = httpServer.shutdown(GRACEFUL_SHUTDOWN_TIMEOUT.toSeconds(), TimeUnit.SECONDS);
try {
logger.info("Waiting for server to shut down... Shutdown timeout is {} seconds", GRACEFUL_SHUTDOWN_TIMEOUT.toSeconds());
scheduler.gracefullyShutdown(GRACEFUL_SHUTDOWN_TIMEOUT);
grizzlyServerShutdownFuture.get();
} catch(Throwable e) {
logger.error("Error while shutting down server.", e);
}
logger.info("Server and scheduler stopped.");
try {
logger.info("Waiting for server to shut down... Shutdown timeout is {} seconds", GRACEFUL_SHUTDOWN_TIMEOUT.toSeconds());
scheduler.gracefullyShutdown(GRACEFUL_SHUTDOWN_TIMEOUT);
grizzlyServerShutdownFuture.get();
logger.info("Server and scheduler stopped.");
} catch(Exception e) {
logger.error("Error while shutting down server.", e);
Thread.currentThread().interrupt();
}
},
"shutdownHook"
));
Expand Down

0 comments on commit 82a2907

Please sign in to comment.