WalletFiles: Don't save any more if executor is shut down.
@@ -113,6 +113,8 @@ public class WalletFiles {
public void saveNow() throws IOException {
// Can be called by any thread. However the wallet is locked whilst saving, so we can have two saves in flight
// but they will serialize (using different temp files).
+ if (executor.isShutdown())
+ return;
Date lastBlockSeenTime = wallet.getLastBlockSeenTime();
log.info("Saving wallet; last seen block is height {}, date {}, hash {}", wallet.getLastBlockSeenHeight(),
lastBlockSeenTime != null ? Utils.dateTimeFormat(lastBlockSeenTime) : "unknown",
@@ -136,7 +138,7 @@ public class WalletFiles {
/** Queues up a save in the background. Useful for not very important wallet changes. */
public void saveLater() {
- if (savePending.getAndSet(true))
+ if (executor.isShutdown() || savePending.getAndSet(true))
return; // Already pending.
executor.schedule(saver, delay, delayTimeUnit);
}
