@VisibleForTesting void internalCreateNode(String path, byte[] bytes, BackgroundCallback callback) throws Exception { client.create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).inBackground(callback).forPath(path, bytes); }
}).forPath(format("%s/%s:%s:%s", pref, address.getAddress().getHostAddress(),
private void reset() throws Exception { setLeadership(false); deleteNode(); BackgroundCallback callback = new BackgroundCallback() { @Override public void processResult(CuratorFramework client, CuratorEvent event) throws Exception { if ( event.getResultCode() == KeeperException.Code.OK.intValue() ) { ourPath = event.getName(); getChildren(); } else { log.error("getChildren() failed. rc = " + event.getResultCode()); } } }; client.create().creatingParentsIfNeeded().withProtection().withMode(CreateMode.EPHEMERAL_SEQUENTIAL).inBackground(callback).forPath(ZKPaths.makePath(latchPath, LOCK_NAME), LeaderSelector.getIdBytes(id)); }