mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-16 04:05:50 +00:00
WalletFiles: Don't save any more if executor is shut down.
This commit is contained in:
parent
e244453073
commit
c9a36647a9
@ -113,6 +113,8 @@ public class WalletFiles {
|
|||||||
public void saveNow() throws IOException {
|
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
|
// 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).
|
// but they will serialize (using different temp files).
|
||||||
|
if (executor.isShutdown())
|
||||||
|
return;
|
||||||
Date lastBlockSeenTime = wallet.getLastBlockSeenTime();
|
Date lastBlockSeenTime = wallet.getLastBlockSeenTime();
|
||||||
log.info("Saving wallet; last seen block is height {}, date {}, hash {}", wallet.getLastBlockSeenHeight(),
|
log.info("Saving wallet; last seen block is height {}, date {}, hash {}", wallet.getLastBlockSeenHeight(),
|
||||||
lastBlockSeenTime != null ? Utils.dateTimeFormat(lastBlockSeenTime) : "unknown",
|
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. */
|
/** Queues up a save in the background. Useful for not very important wallet changes. */
|
||||||
public void saveLater() {
|
public void saveLater() {
|
||||||
if (savePending.getAndSet(true))
|
if (executor.isShutdown() || savePending.getAndSet(true))
|
||||||
return; // Already pending.
|
return; // Already pending.
|
||||||
executor.schedule(saver, delay, delayTimeUnit);
|
executor.schedule(saver, delay, delayTimeUnit);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user