@Override public synchronized void nodeDeleted(String path) { if (path.equals(node)) { try { if (ZKUtil.watchAndCheckExists(watcher, node)) { nodeCreated(path); } else { this.data = null; } } catch (KeeperException e) { abortable.abort("Unexpected exception handling nodeDeleted event", e); } } }
synchronized (clusterHasActiveMaster) { if (ZKUtil .watchAndCheckExists(watcher, watcher.getMasterAddressZNode())) {
/** * List all the children of the specified znode, setting a watch for children * changes and also setting a watch on every individual child in order to get * the NodeCreated and NodeDeleted events. * * @param zkw * zookeeper reference * @param znode * node to get children of and watch * @return list of znode names, null if the node doesn't exist * @throws org.apache.zookeeper.KeeperException */ public static List<String> listChildrenAndWatchThem(ZooKeeperWatcher zkw, String znode) throws KeeperException { List<String> children = listChildrenAndWatchForNewChildren(zkw, znode); if (children == null) { return null; } for (String child : children) { watchAndCheckExists(zkw, joinZNode(znode, child)); } return children; }
CreateMode.EPHEMERAL); } catch (KeeperException.NodeExistsException nee) { if (!watchAndCheckExists(zkw, znode)) {
if (ZKUtil.watchAndCheckExists(watcher, node)) { byte[] data = ZKUtil.getDataAndWatch(watcher, node); if (data != null) {
@Override public void run() { try { // Just make sure we see the changes for the new znodes List<String> children = ZKUtil.listChildrenAndWatchForNewChildren( watcher, watcher.assignmentZNode); if (children != null) { for (String child : children) { // if entityGroup is in transition, we already have a watch // on it, so no need to watch it again. So, as I know for now, // this is needed to watch splitting nodes only. if (!entityGroupStates.isEntityGroupInTransition(child)) { ZKUtil.watchAndCheckExists(watcher, ZKUtil.joinZNode(watcher.assignmentZNode, child)); } } } } catch (KeeperException e) { server.abort("Unexpected ZK exception reading unassigned children", e); } } });