mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 10:15:52 +00:00
Wallet: Enable autoSaveListener for 0-delay autosave.
This commit is contained in:
parent
c4572696b1
commit
7cd38bc77a
@ -628,8 +628,8 @@ public class Wallet implements Serializable, BlockChainListener {
|
|||||||
try {
|
try {
|
||||||
Preconditions.checkArgument(delayTime >= 0);
|
Preconditions.checkArgument(delayTime >= 0);
|
||||||
autosaveToFile = Preconditions.checkNotNull(f);
|
autosaveToFile = Preconditions.checkNotNull(f);
|
||||||
|
autosaveEventListener = eventListener;
|
||||||
if (delayTime > 0) {
|
if (delayTime > 0) {
|
||||||
autosaveEventListener = eventListener;
|
|
||||||
autosaveDelayMs = TimeUnit.MILLISECONDS.convert(delayTime, timeUnit);
|
autosaveDelayMs = TimeUnit.MILLISECONDS.convert(delayTime, timeUnit);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -643,11 +643,7 @@ public class Wallet implements Serializable, BlockChainListener {
|
|||||||
if (this.autosaveToFile == null) return;
|
if (this.autosaveToFile == null) return;
|
||||||
if (autosaveDelayMs == 0) {
|
if (autosaveDelayMs == 0) {
|
||||||
// No delay time was specified, so save now.
|
// No delay time was specified, so save now.
|
||||||
try {
|
autoSave();
|
||||||
saveToFile(autosaveToFile);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// If we need to, tell the auto save thread to wake us up. This will start the background thread if one
|
// If we need to, tell the auto save thread to wake us up. This will start the background thread if one
|
||||||
// doesn't already exist. It will wake up once the delay expires and call autoSave().
|
// doesn't already exist. It will wake up once the delay expires and call autoSave().
|
||||||
|
Loading…
x
Reference in New Issue
Block a user