Avoid errors during startup/shutdown

This commit is contained in:
Andrea Cavalli 2021-11-09 15:59:59 +01:00
parent 6439a1b486
commit 5bbe67f68f
1 changed files with 5 additions and 1 deletions

View File

@ -50,7 +50,11 @@ public final class InternalReactiveClient implements ClientEventsHandler, Reacti
this.clientManager = clientManager;
this.updateHandler = new Handler<>(this::onUpdateFromHandler, this::onUpdateException);
this.defaultExceptionHandler = this::onDefaultException;
Runtime.getRuntime().addShutdownHook(shutdownHook);
try {
Runtime.getRuntime().addShutdownHook(shutdownHook);
} catch (IllegalStateException ex) {
this.onJVMShutdown();
}
}
@Override