Skip to content

Commit

Permalink
[RM-84612] corrected after review
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-Smirnov-Exactpro committed Feb 8, 2024
1 parent fa53aaf commit f9ae3ab
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/main/java/com/exactpro/th2/hand/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,19 @@ public long getCurrentTime() {
public void run(String[] args) {
try (CommonFactory factory = CommonFactory.createFromArguments(args)) {
Config config = getConfig(factory);
final HandServer handServer = new HandServer(config, getCurrentTime());
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
LOGGER.info("*** Closing hand server because JVM is shutting down");
try {
handServer.close();
} catch (InterruptedException e) {
LOGGER.warn("Server termination await was interrupted", e);
}
LOGGER.info("*** hand server closed");
}));
handServer.start();
handServer.blockUntilShutdown();
try (HandServer handServer = new HandServer(config, getCurrentTime())) {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
LOGGER.info("*** Closing hand server because JVM is shutting down");
try {
handServer.close();
} catch (InterruptedException e) {
LOGGER.warn("Server termination await was interrupted", e);
}
LOGGER.info("*** hand server closed");
}));
handServer.start();
handServer.blockUntilShutdown();
}
} catch (Exception e) {
LOGGER.error("Could not to start Hand server", e);
closeApp();
Expand Down

0 comments on commit f9ae3ab

Please sign in to comment.