Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,6 @@ public CompletableFuture<Optional<GetResult>> get(String path) {
if (code == Code.OK) {
future.complete(Optional.of(new GetResult(data, getStat(path1, stat))));
} else if (code == Code.NONODE) {
// Place a watch on the non-existing node, so we'll get notified
// when it gets created and we can invalidate the negative cache.
existsFromStore(path).thenAccept(exists -> {
if (exists) {
get(path).thenAccept(c -> future.complete(c))
.exceptionally(ex -> {
future.completeExceptionally(ex);
return null;
});
} else {
// Z-node does not exist
future.complete(Optional.empty());
}
}).exceptionally(ex -> {
future.completeExceptionally(ex);
return null;
});
future.complete(Optional.empty());
} else {
future.completeExceptionally(getException(code, path));
Expand All @@ -180,25 +163,8 @@ public CompletableFuture<List<String>> getChildrenFromStore(String path) {
Collections.sort(children);
future.complete(children);
} else if (code == Code.NONODE) {
// The node we want may not exist yet, so put a watcher on its existence
// before throwing up the exception. Its possible that the node could have
// been created after the call to getChildren, but before the call to exists().
// If this is the case, exists will return true, and we just call getChildren
// again.
existsFromStore(path).thenAccept(exists -> {
if (exists) {
getChildrenFromStore(path).thenAccept(c -> future.complete(c)).exceptionally(ex -> {
future.completeExceptionally(ex);
return null;
});
} else {
// Z-node does not exist
future.complete(Collections.emptyList());
}
}).exceptionally(ex -> {
future.completeExceptionally(ex);
return null;
});
// Z-node does not exist
future.complete(Collections.emptyList());
} else {
future.completeExceptionally(getException(code, path));
}
Expand Down