@Override public Stat execute() throws KeeperException, InterruptedException { return zk.exists(childPath, false); } });
@Override public Stat execute() throws KeeperException, InterruptedException { return zk.exists(lockPath, null); } });
@Override public Boolean execute() throws KeeperException, InterruptedException { return zk.exists(zkRoot, false) != null; } });
@Override public Stat execute() throws KeeperException, InterruptedException { return zk.exists(pathToWatch, watcher); } });
@Override public Stat execute() throws KeeperException, InterruptedException { return zk.exists(lockPath, null); } });
@Override public Stat execute() throws KeeperException, InterruptedException { return zk.exists(pathToWatch, watcher); } });
@Override public Boolean execute() throws KeeperException, InterruptedException { return zk.exists(zkRoot, false) != null; } });
@Override public Stat execute() throws KeeperException, InterruptedException { return zk.exists(childPath, false); } });
@Override public Boolean execute() throws KeeperException, InterruptedException { if (zk.exists(subPath.toString(), false) == null) { try { zk.create(subPath.toString(), newData, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); return true; } catch (KeeperException.NodeExistsException e) { return false; } } return false; } });
@Override public Boolean execute() throws KeeperException, InterruptedException { if (zk.exists(subPath.toString(), false) == null) { try { zk.create(subPath.toString(), newData, CreateMode.PERSISTENT); return true; } catch (KeeperException.NodeExistsException e) { return false; } } return false; } });
@Override public Boolean execute() throws KeeperException, InterruptedException { Stat stat = zk.exists(path, false); if (stat != null) { try { zk.delete(path, stat.getVersion()); } catch (KeeperException.NoNodeException nne) { // This is ok, the node is already gone } // We don't catch BadVersion or NotEmpty as these are probably signs that there is something // unexpected going on with the node that is to be deleted } return true; } });
@Override public Boolean execute() throws KeeperException, InterruptedException { Stat stat = zk.exists(path, false); if (stat != null) { try { zk.delete(path, stat.getVersion()); } catch (KeeperException.NoNodeException nne) { // This is ok, the node is already gone } // We don't catch BadVersion or NotEmpty as these are probably signs that there is something // unexpected going on with the node that is to be deleted } return true; } });
@Override public Object execute() throws KeeperException, InterruptedException { byte[] data = zk.getData(indexerPath, false, null); String trashPath = indexerTrashPath + "/" + indexerName; // An indexer with the same name might have existed before and hence already exist // in the indexer trash, handle this by appending a sequence number until a unique // name is found. String baseTrashpath = trashPath; int count = 0; while (zk.exists(trashPath, false) != null) { count++; trashPath = baseTrashpath + "." + count; } zk.create(trashPath, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); return null; } });
@Override public Object execute() throws KeeperException, InterruptedException { byte[] data = zk.getData(indexerPath, false, null); String trashPath = indexerTrashPath + "/" + indexerName; // An indexer with the same name might have existed before and hence already exist // in the indexer trash, handle this by appending a sequence number until a unique // name is found. String baseTrashpath = trashPath; int count = 0; while (zk.exists(trashPath, false) != null) { count++; trashPath = baseTrashpath + "." + count; } zk.create(trashPath, data, CreateMode.PERSISTENT); return null; } });
Stat stat = zk.exists(electionPath + "/" + leader, false);
Stat stat = zk.exists(electionPath + "/" + leader, false);
try { if (zk.exists(indexerLockPath, false) != null) { List<String> children = Collections.emptyList(); try {
try { if (zk.exists(indexerLockPath, false) != null) { List<String> children = Collections.emptyList(); try {
if (zk.exists(regionServerPath, false) == null) { return new ReplicationStatus(statusByPeerAndServer);