mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Add new methods and refactor APIs. Needed later for new classes....
This commit is contained in:
parent
7122ef0356
commit
df90b2440a
1 changed files with 8 additions and 3 deletions
|
@ -77,12 +77,17 @@ public class Storage<T extends PersistableEnvelope> {
|
|||
this.corruptedDatabaseFilesHandler = corruptedDatabaseFilesHandler;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public T getPersisted(String fileName) {
|
||||
return getPersisted(new File(dir, fileName));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public T initAndGetPersistedWithFileName(String fileName, long delay) {
|
||||
this.fileName = fileName;
|
||||
storageFile = new File(dir, fileName);
|
||||
fileManager = new FileManager<>(dir, storageFile, delay, persistenceProtoResolver);
|
||||
return getPersisted();
|
||||
return getPersisted(storageFile);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -96,7 +101,7 @@ public class Storage<T extends PersistableEnvelope> {
|
|||
this.fileName = fileName;
|
||||
storageFile = new File(dir, fileName);
|
||||
fileManager = new FileManager<>(dir, storageFile, delay, persistenceProtoResolver);
|
||||
return getPersisted();
|
||||
return getPersisted(storageFile);
|
||||
}
|
||||
|
||||
public void queueUpForSave() {
|
||||
|
@ -144,7 +149,7 @@ public class Storage<T extends PersistableEnvelope> {
|
|||
// We do the file read on the UI thread to avoid problems from multi threading.
|
||||
// Data are small and read is done only at startup, so it is no performance issue.
|
||||
@Nullable
|
||||
private T getPersisted() {
|
||||
private T getPersisted(File storageFile) {
|
||||
if (storageFile.exists()) {
|
||||
long now = System.currentTimeMillis();
|
||||
try {
|
||||
|
|
Loading…
Add table
Reference in a new issue