@Override public void onSuccess(String result) { // Path deleted successfully. Operation done. resultFuture.set(result); }
@Override public void onFailure(Throwable t) { if (exceptionType.isAssignableFrom(t.getClass())) { resultFuture.set(errorResult); } else if (t instanceof CancellationException) { resultFuture.cancel(true); } else { resultFuture.setException(t); } } }, Threads.SAME_THREAD_EXECUTOR);
@Override public void run() { try { String relativePath = from.get().substring(namespace.length()); to.set(relativePath.isEmpty() ? "/" : relativePath); } catch (Exception e) { to.setException(e.getCause()); } } }, Threads.SAME_THREAD_EXECUTOR);
@Override public void onSuccess(String path) { // Propagate if creation was successful result.set(path); }
@Override @SuppressWarnings("unchecked") public void processResult(int rc, String path, Object ctx, String name) { SettableOperationFuture<String> result = (SettableOperationFuture<String>) ctx; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.OK) { result.set((name == null || name.isEmpty()) ? path : name); return; } result.setException(KeeperException.create(code, result.getRequestPath())); } };
@Override public void onSuccess(String path) { // Propagate if creation was successful result.set(path); }
@Override @SuppressWarnings("unchecked") public void processResult(int rc, String path, Object ctx, String name) { SettableOperationFuture<String> result = (SettableOperationFuture<String>) ctx; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.OK) { result.set((name == null || name.isEmpty()) ? path : name); return; } result.setException(KeeperException.create(code, result.getRequestPath())); } };
@Override public void onSuccess(String path) { // Propagate if creation was successful result.set(path); }
@Override @SuppressWarnings("unchecked") public void processResult(int rc, String path, Object ctx, Stat stat) { SettableOperationFuture<Stat> result = (SettableOperationFuture<Stat>) ctx; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.OK) { result.set(stat); return; } result.setException(KeeperException.create(code, result.getRequestPath())); } };
@Override public void onSuccess(String path) { // Propagate if creation was successful result.set(path); }
@Override @SuppressWarnings("unchecked") public void processResult(int rc, String path, Object ctx, Stat stat) { SettableOperationFuture<Stat> result = (SettableOperationFuture<Stat>) ctx; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.OK) { result.set(stat); return; } result.setException(KeeperException.create(code, result.getRequestPath())); } };
@Override public void onSuccess(String result) { // Create succeeded, just set the result to the resultFuture resultFuture.set(result); }
@Override @SuppressWarnings("unchecked") public void processResult(int rc, String path, Object ctx, Stat stat) { SettableOperationFuture<Stat> result = (SettableOperationFuture<Stat>) ctx; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.OK || code == KeeperException.Code.NONODE) { result.set(stat); return; } result.setException(KeeperException.create(code, result.getRequestPath())); } };
@Override public void onSuccess(String path) { // Propagate if creation was successful result.set(path); }
@Override @SuppressWarnings("unchecked") public void processResult(int rc, String path, Object ctx, Stat stat) { SettableOperationFuture<Stat> result = (SettableOperationFuture<Stat>) ctx; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.OK) { result.set(stat); return; } result.setException(KeeperException.create(code, result.getRequestPath())); } };
@Override @SuppressWarnings("unchecked") public void processResult(int rc, String path, Object ctx, byte[] data, Stat stat) { SettableOperationFuture<NodeData> result = (SettableOperationFuture<NodeData>) ctx; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.OK) { result.set(new BasicNodeData(data, stat)); return; } result.setException(KeeperException.create(code, result.getRequestPath())); } };
@Override @SuppressWarnings("unchecked") public void processResult(int rc, String path, Object ctx, List<String> children, Stat stat) { SettableOperationFuture<NodeChildren> result = (SettableOperationFuture<NodeChildren>) ctx; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.OK) { result.set(new BasicNodeChildren(children, stat)); return; } result.setException(KeeperException.create(code, result.getRequestPath())); } };
@Override @SuppressWarnings("unchecked") public void processResult(int rc, String path, Object ctx, byte[] data, Stat stat) { SettableOperationFuture<NodeData> result = (SettableOperationFuture<NodeData>) ctx; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.OK) { result.set(new BasicNodeData(data, stat)); return; } result.setException(KeeperException.create(code, result.getRequestPath())); } };
@Override @SuppressWarnings("unchecked") public void processResult(int rc, String path, Object ctx, List<ACL> acl, Stat stat) { SettableOperationFuture<ACLData> result = (SettableOperationFuture<ACLData>) ctx; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.OK) { result.set(new BasicACLData(acl, stat)); return; } result.setException(KeeperException.create(code, result.getRequestPath())); } };
@Override @SuppressWarnings("unchecked") public void processResult(int rc, String path, Object ctx, List<ACL> acl, Stat stat) { SettableOperationFuture<ACLData> result = (SettableOperationFuture<ACLData>) ctx; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.OK) { result.set(new BasicACLData(acl, stat)); return; } result.setException(KeeperException.create(code, result.getRequestPath())); } };