|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.bitcoin.wallet.WalletFiles
public class WalletFiles
A class that handles atomic and optionally delayed writing of the wallet file to disk. In future: backups too. It can be useful to delay writing of a wallet file to disk on slow devices where disk and serialization overhead can come to dominate the chain processing speed, i.e. on Android phones. By coalescing writes and doing serialization and disk IO on a background thread performance can be improved.
| Nested Class Summary | |
|---|---|
static interface |
WalletFiles.Listener
Implementors can do pre/post treatment of the wallet file. |
| Constructor Summary | |
|---|---|
WalletFiles(Wallet wallet,
File file,
long delay,
TimeUnit delayTimeUnit)
|
|
| Method Summary | |
|---|---|
void |
saveLater()
Queues up a save in the background. |
void |
saveNow()
Actually write the wallet file to disk, using an atomic rename when possible. |
void |
setListener(WalletFiles.Listener listener)
The given listener will be called on the autosave thread before and after the wallet is saved to disk. |
void |
shutdownAndWait()
Shut down auto-saving. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WalletFiles(Wallet wallet,
File file,
long delay,
TimeUnit delayTimeUnit)
| Method Detail |
|---|
public void setListener(@Nonnull
WalletFiles.Listener listener)
public void saveNow()
throws IOException
IOExceptionpublic void saveLater()
public void shutdownAndWait()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||