Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call completeHandler if services in store services is empty. #4963

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,6 @@ public void readFromResources(String postFix, Runnable completeHandler) {
BooleanProperty protectedDataStoreServiceReady = new SimpleBooleanProperty();
BooleanProperty resourceDataStoreServiceReady = new SimpleBooleanProperty();

appendOnlyDataStoreService.readFromResources(postFix, () -> appendOnlyDataStoreServiceReady.set(true));
protectedDataStoreService.readFromResources(postFix, () -> {
map.putAll(protectedDataStoreService.getMap());
protectedDataStoreServiceReady.set(true);
});
resourceDataStoreService.readFromResources(postFix, () -> resourceDataStoreServiceReady.set(true));

readFromResourcesCompleteBinding = EasyBind.combine(appendOnlyDataStoreServiceReady,
protectedDataStoreServiceReady,
resourceDataStoreServiceReady,
Expand All @@ -225,6 +218,13 @@ public void readFromResources(String postFix, Runnable completeHandler) {
completeHandler.run();
}
});

appendOnlyDataStoreService.readFromResources(postFix, () -> appendOnlyDataStoreServiceReady.set(true));
protectedDataStoreService.readFromResources(postFix, () -> {
map.putAll(protectedDataStoreService.getMap());
protectedDataStoreServiceReady.set(true);
});
resourceDataStoreService.readFromResources(postFix, () -> resourceDataStoreServiceReady.set(true));
}

// Uses synchronous execution on the userThread. Only used by tests. The async methods should be used by app code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public void addService(MapStoreService<? extends PersistableNetworkPayloadStore<
}

public void readFromResources(String postFix, Runnable completeHandler) {
if (services.isEmpty()) {
completeHandler.run();
return;
}
AtomicInteger remaining = new AtomicInteger(services.size());
services.forEach(service -> {
service.readFromResources(postFix, () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ public void addService(MapStoreService<? extends PersistableEnvelope, ProtectedS
}

public void readFromResources(String postFix, Runnable completeHandler) {
if (services.isEmpty()) {
completeHandler.run();
return;
}
AtomicInteger remaining = new AtomicInteger(services.size());
services.forEach(service -> {
service.readFromResources(postFix, () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public void addService(StoreService<? extends PersistableEnvelope> service) {
}

public void readFromResources(String postFix, Runnable completeHandler) {
if (services.isEmpty()) {
completeHandler.run();
return;
}
AtomicInteger remaining = new AtomicInteger(services.size());
services.forEach(service -> {
service.readFromResources(postFix, () -> {
Expand Down