mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-20 10:12:19 +01:00
WalletAppKit: move shutdownHook into its own method
This commit is contained in:
parent
509694d9ad
commit
952751eee2
@ -469,14 +469,18 @@ public class WalletAppKit extends AbstractIdleService {
|
||||
}
|
||||
|
||||
private void installShutdownHook() {
|
||||
if (autoStop) Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
try {
|
||||
WalletAppKit.this.stopAsync();
|
||||
WalletAppKit.this.awaitTerminated();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}));
|
||||
if (autoStop) {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(this::shutdownHook));
|
||||
}
|
||||
}
|
||||
|
||||
private void shutdownHook() {
|
||||
try {
|
||||
stopAsync();
|
||||
awaitTerminated();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user