WalletAppKit: move shutdownHook into its own method
@@ -469,14 +469,18 @@ public class WalletAppKit extends AbstractIdleService {
}
private void installShutdownHook() {
- if (autoStop) Runtime.getRuntime().addShutdownHook(new Thread(() -> {
+ if (autoStop) {
+ Runtime.getRuntime().addShutdownHook(new Thread(this::shutdownHook));
+ }
+ }
+
+ private void shutdownHook() {
try {
- WalletAppKit.this.stopAsync();
- WalletAppKit.this.awaitTerminated();
+ stopAsync();
+ awaitTerminated();
} catch (Exception e) {
throw new RuntimeException(e);
}
- }));
}
@Override
