protected static void createNode(CuratorFramework curator, String path, byte[] data, List<ACL> acls, CreateMode mode) throws Exception { ProtectACLCreateModePathAndBytesable<String> builder = curator.create().creatingParentsIfNeeded(); LOG.debug("Creating node [path = {}], [data = {}], [acls = {}], [mode = {}]", path, asString(data), acls, mode); if (acls == null) { if (mode == null) { TransactionalState.forPath(builder, path, data); } else { TransactionalState.forPath(builder.withMode(mode), path, data); } return; } TransactionalState.forPath(builder.withACL(acls), path, data); }
public static String createNode(CuratorFramework zk, String path, byte[] data, CreateMode mode, List<ACL> acls) { String ret = null; try { String npath = normalizePath(path); ret = zk.create().creatingParentsIfNeeded().withMode(mode).withACL(acls).forPath(npath, data); } catch (Exception e) { throw Utils.wrapInRuntime(e); } return ret; }
zkClient.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT) .withACL(ZooDefs.Ids.OPEN_ACL_UNSAFE).forPath(BLOBSTORE_MAX_KEY_SEQUENCE_SUBTREE + "/" + key); zkClient.setData().forPath(BLOBSTORE_MAX_KEY_SEQUENCE_SUBTREE + "/" + key,
protected void initWatcher() throws Exception { // create base path if necessary Stat stat = this.client.checkExists().usingWatcher(this).forPath(this.name); if (stat == null) { String path = this.client.create().creatingParentsIfNeeded().forPath(this.name); LOG.info("Created: " + path); } }
public void send(String toPath, byte[] signal) throws Exception { Stat stat = this.client.checkExists().forPath(toPath); if (stat == null) { String path = this.client.create().creatingParentsIfNeeded().forPath(toPath); LOG.info("Created: " + path); } this.client.setData().forPath(toPath, signal); } }
public void send(byte[] signal) throws Exception { Stat stat = this.client.checkExists().forPath(this.name); if (stat == null) { String path = this.client.create().creatingParentsIfNeeded().forPath(this.name); LOG.info("Created: " + path); } this.client.setData().forPath(this.name, signal); }
protected static void createNode(CuratorFramework curator, String path, byte[] data, List<ACL> acls, CreateMode mode) throws Exception { ProtectACLCreateModePathAndBytesable<String> builder = curator.create().creatingParentsIfNeeded(); LOG.debug("Creating node [path = {}], [data = {}], [acls = {}], [mode = {}]", path, asString(data), acls, mode); if (acls == null) { if (mode == null ) { TransactionalState.forPath(builder, path, data); } else { TransactionalState.forPath(builder.withMode(mode), path, data); } return; } TransactionalState.forPath(builder.withACL(acls), path, data); }
public static String createNode(CuratorFramework zk, String path, byte[] data, org.apache.zookeeper.CreateMode mode, List<ACL> acls) { String ret = null; try { String npath = normalizePath(path); ret = zk.create().creatingParentsIfNeeded().withMode(mode).withACL(acls).forPath(npath, data); } catch (Exception e) { throw Utils.wrapInRuntime(e); } return ret; }
protected static void createNode(CuratorFramework curator, String path, byte[] data, List<ACL> acls, CreateMode mode) throws Exception { ProtectACLCreateModePathAndBytesable<String> builder = curator.create().creatingParentsIfNeeded(); if (acls == null) { if (mode == null ) { TransactionalState.forPath(builder, path, data); } else { TransactionalState.forPath(builder.withMode(mode), path, data); } return; } TransactionalState.forPath(builder.withACL(acls), path, data); }
zkClient.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT) .withACL(ZooDefs.Ids.OPEN_ACL_UNSAFE).forPath(BLOBSTORE_MAX_KEY_SEQUENCE_SUBTREE + "/" + key); zkClient.setData().forPath(BLOBSTORE_MAX_KEY_SEQUENCE_SUBTREE + "/" + key,