mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Fix wrong thread at shutdownhook
This commit is contained in:
parent
6f641bff1c
commit
a4573208b4
@ -67,17 +67,9 @@ public class FileManager<T> {
|
|||||||
saveNowInternal(serializable);
|
saveNowInternal(serializable);
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
UserThread.execute(FileManager.this::shutDown);
|
||||||
@Override
|
}, "FileManager.ShutDownHook"));
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
FileManager.this.shutDown();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,8 +119,9 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||||||
openOffers.forEach(e -> e.getOffer().setPriceFeed(priceFeed));
|
openOffers.forEach(e -> e.getOffer().setPriceFeed(priceFeed));
|
||||||
|
|
||||||
// In case the app did get killed the shutDown from the modules is not called, so we use a shutdown hook
|
// In case the app did get killed the shutDown from the modules is not called, so we use a shutdown hook
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(OpenOfferManager.this::shutDown,
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||||
"OpenOfferManager.ShutDownHook"));
|
UserThread.execute(OpenOfferManager.this::shutDown);
|
||||||
|
}, "OpenOfferManager.ShutDownHook"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAllServicesInitialized() {
|
public void onAllServicesInitialized() {
|
||||||
|
@ -359,7 +359,7 @@ public class BitsquareApp extends Application {
|
|||||||
log.info("App shutdown complete");
|
log.info("App shutdown complete");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
});
|
});
|
||||||
}, 100, TimeUnit.MILLISECONDS);
|
}, 200, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void gracefulShutDown(ResultHandler resultHandler) {
|
private void gracefulShutDown(ResultHandler resultHandler) {
|
||||||
|
Loading…
Reference in New Issue
Block a user