3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-15 03:35:52 +00:00

Propagate context to the wallet autosave thread.

This commit is contained in:
Mike Hearn 2015-03-21 17:17:38 +01:00
parent e3f70c6d4f
commit 50e7e14763
2 changed files with 7 additions and 1 deletions

View File

@ -1404,6 +1404,11 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
return params;
}
/** Returns the API context that this wallet was created with. */
public Context getContext() {
return context;
}
/**
* <p>Returns a wallet deserialized from the given file. Extensions previously saved with the wallet can be
* deserialized by calling @{@link WalletExtension#deserializeWalletExtension(Wallet, byte[])}}</p>

View File

@ -17,7 +17,7 @@
package org.bitcoinj.wallet;
import org.bitcoinj.core.Wallet;
import org.bitcoinj.core.*;
import org.bitcoinj.utils.Threading;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.slf4j.Logger;
@ -88,6 +88,7 @@ public class WalletFiles {
this.saver = new Callable<Void>() {
@Override public Void call() throws Exception {
Context.propagate(wallet.getContext());
// Runs in an auto save thread.
if (!savePending.getAndSet(false)) {
// Some other scheduled request already beat us to it.