/** * Create a znode if there is no other znode there * * @param path * path to create * @param data * data to set on the final znode * @param acl * acls on each znode created * @param createMode * only affects the final znode * @param recursive * if true, creates all ancestors * @return Path of created znode or Stat of set znode * @throws InterruptedException * @throws KeeperException * Both KeeperException InterruptedException are thrown from {@link ZooKeeper} methods. */ public PathStat createOnceExt(final String path, byte[] data, List<ACL> acl, CreateMode createMode, boolean recursive) throws KeeperException, InterruptedException { try { return new PathStat(createExt(path, data, acl, createMode, recursive), null); } catch (KeeperException.NodeExistsException e) { LOG.warn("createOnceExt: Node already exists on path {}", path); } return null; }
if(bytes.length > zkDataLimit) { getZooKeeper().createExt(splitZnode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, true); int childrenSize = (bytes.length % zkDataLimit == 0) ? (bytes.length / zkDataLimit) : (bytes.length / zkDataLimit) + 1; getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, createNode, false); return true; } else { getZooKeeper().createExt(znode, bytes, Ids.OPEN_ACL_UNSAFE, createNode, false); return false;
Stat setStat = null; try { createdPath = createExt(path, data, acl, createMode, recursive); } catch (KeeperException.NodeExistsException e) { LOG.warn("createOrSet: Node exists on path {}", path);
getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, true); } catch (KeeperException.NodeExistsException e) { LOG.warn("Node exists: {}", znode); String znodeValue = InetAddress.getLocalHost().getHostName() + ":" + NettyMasterCoordinator.this.messageServerPort + ":" + 1; getZooKeeper().createExt(znode, znodeValue.getBytes(Charset.forName("UTF-8")), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); LOG.info("Master znode initialization with server info {}", znodeValue);
.createExt(appWorkerNode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false);
stat = getZooKeeper().exists(znode, false); if(stat == null) { getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); stat = getZooKeeper().exists(znode, false); if(stat == null) { getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); stat = getZooKeeper().exists(znode, false); if(stat == null) { getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); stat = getZooKeeper().exists(znode, false); if(stat == null) { getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); } catch (KeeperException.NodeExistsException e) { LOG.warn("Has such node:{}", znode);
stat = getZooKeeper().exists(znode, false); if(stat == null) { getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); stat = getZooKeeper().exists(znode, false); if(stat == null) { getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); stat = getZooKeeper().exists(znode, false); if(stat == null) { getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); stat = getZooKeeper().exists(znode, false); if(stat == null) { getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); } catch (KeeperException.NodeExistsException e) { LOG.warn("Has such node:{}", znode);
getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); znode = getCurrentMasterNode(context.getAppId(), context.getCurrentIteration()).toString(); getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); } catch (KeeperException.NodeExistsException e) { LOG.warn("Node exists: {}", znode);
getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); znode = getCurrentMasterNode(context.getAppId(), context.getCurrentIteration()).toString(); getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); } catch (KeeperException.NodeExistsException e) { LOG.warn("Node exists: {}", znode);
workerBaseNode = getWorkerBaseNode(context.getAppId(), context.getCurrentIteration() + 1) .toString(); getZooKeeper().createExt(workerBaseNode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); } catch (KeeperException.NodeExistsException e) { LOG.warn("Node exists: {}", workerBaseNode);