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); }
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); } }
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); }
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); }