mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Map result handler call to user thread
This commit is contained in:
parent
997c3a0932
commit
dd7f40d5bf
@ -226,6 +226,7 @@ public class PersistenceManager<T extends PersistableEnvelope> {
|
||||
|
||||
/**
|
||||
* Read persisted file in a thread.
|
||||
* We map result handler calls to UserThread, so clients don't need to worry about threading
|
||||
*
|
||||
* @param fileName File name of our persisted data.
|
||||
* @param resultHandler Consumer of persisted data once it was read from disk.
|
||||
@ -235,9 +236,9 @@ public class PersistenceManager<T extends PersistableEnvelope> {
|
||||
new Thread(() -> {
|
||||
T persisted = getPersisted(fileName);
|
||||
if (persisted != null) {
|
||||
resultHandler.accept(persisted);
|
||||
UserThread.execute(() -> resultHandler.accept(persisted));
|
||||
} else {
|
||||
orElse.run();
|
||||
UserThread.execute(orElse);
|
||||
}
|
||||
}, "PersistenceManager-read-" + fileName).start();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user