private void incrementMaxSequenceNumber(CuratorFramework zkClient, int count) throws Exception { zkClient.setData().forPath(BLOBSTORE_MAX_KEY_SEQUENCE_SUBTREE + "/" + key, ByteBuffer.allocate(INT_CAPACITY).putInt(count + 1).array()); }
public static Stat setData(CuratorFramework zk, String path, byte[] data) { try { String npath = normalizePath(path); return zk.setData().forPath(npath, data); } catch (Exception e) { throw Utils.wrapInRuntime(e); } }
public void setData(String path, Object obj) { path = "/" + path; byte[] ser; try { ser = JSONValue.toJSONString(obj).getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } try { if (_curator.checkExists().forPath(path) != null) { _curator.setData().forPath(path, ser); } else { TransactionalState.createNode(_curator, path, ser, _zkAcls, CreateMode.PERSISTENT); } } catch (KeeperException.NodeExistsException nne) { LOG.warn("Node {} already created.", path); } catch (Exception e) { throw new RuntimeException(e); } }
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, ByteBuffer.allocate(INT_CAPACITY).putInt(INITIAL_SEQUENCE_NUMBER).array()); return INITIAL_SEQUENCE_NUMBER;
private void incrementMaxSequenceNumber(CuratorFramework zkClient, int count) throws Exception { zkClient.setData().forPath(BLOBSTORE_MAX_KEY_SEQUENCE_SUBTREE + "/" + key, ByteBuffer.allocate(INT_CAPACITY).putInt(count + 1).array()); }
public static Stat setData(CuratorFramework zk, String path, byte[] data){ try { String npath = normalizePath(path); return zk.setData().forPath(npath, data); } catch (Exception e) { throw Utils.wrapInRuntime(e); } }
public void setData(String path, Object obj) { path = "/" + path; byte[] ser; try { ser = JSONValue.toJSONString(obj).getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } try { if(_curator.checkExists().forPath(path)!=null) { _curator.setData().forPath(path, ser); } else { TransactionalState.createNode(_curator, path, ser, _zkAcls, CreateMode.PERSISTENT); } } catch (KeeperException.NodeExistsException nne){ LOG.warn("Node {} already created.", path); } catch(Exception e) { throw new RuntimeException(e); } }
public void setData(String path, Object obj) { path = "/" + path; byte[] ser = _ser.serializeObject(obj); try { if(_curator.checkExists().forPath(path)!=null) { _curator.setData().forPath(path, ser); } else { TransactionalState.createNode(_curator, path, ser, _zkAcls, CreateMode.PERSISTENT); } } catch (KeeperException.NodeExistsException nne){ LOG.warn("Node {} already created.", path); } catch(Exception e) { throw new RuntimeException(e); } }
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); }
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, ByteBuffer.allocate(INT_CAPACITY).putInt(INITIAL_SEQUENCE_NUMBER).array()); return INITIAL_SEQUENCE_NUMBER;