@Override public void register(CuratorTransaction transaction) throws Exception { transaction.setData().forPath(path, bytes); }
CuratorTransaction curatorTransaction = client.inTransaction(); for (Map.Entry<String, String> entry : transactionInfo.entrySet()) { curatorTransaction = curatorTransaction .setData().forNode(entry.getKey(), entry.getValue()).and(); } // If there was at least one entry in transactionInfo, and() makes it a CuratorTransactionFinal if (curatorTransaction instanceof CuratorTransactionFinal) { ((CuratorTransactionFinal)curatorTransaction).commit(); }
@Override public void register(CuratorTransaction transaction) throws Exception { transaction.setData().forPath(path, bytes); }
@Override public TransactionSetDataBuilder setData() { return new TransactionSetDataBuilderDecorator(inner.setData()); }
@Override public CuratorTransaction and(CuratorTransaction transaction) throws Exception { return transaction.setData().forPath(path, data).and(); }
CuratorTransactionFinal transaction; if (nodeExists(servicePath) && !request.isUpstreamUpdateOnly()) { transaction = curatorFramework.inTransaction().setData().forPath(servicePath, serialize(request.getLoadBalancerService())).and(); } else { transaction = curatorFramework.inTransaction().create().forPath(servicePath, serialize(request.getLoadBalancerService())).and();
@Override public void write(StateMachineContext<S,E> context, Stat stat) { byte[] data = serialize(context); CuratorTransaction tx = curatorClient.inTransaction(); try { CuratorTransactionFinal tt = tx.setData().withVersion(stat.getVersion()).forPath(path, data).and(); if (logPath != null) { tt = tt.setData().forPath(logPath + "/" + stat.getVersion() % logSize, data).and(); } Collection<CuratorTransactionResult> results = tt.commit(); int version = results.iterator().next().getResultStat().getVersion(); stat.setVersion(version); } catch (Exception e) { throw new StateMachineException("Error persisting data", e); } }
setData(dst, ZkPath.CONFIG_ENSEMBLE_URL.getPath(), connectionUrl); obtainValid(curator).inTransaction() .setData().forPath(ZkPath.CONFIG_ENSEMBLE_PASSWORD.getPath(), PasswordEncoder.encode(options.getZookeeperPassword()).getBytes(Charsets.UTF_8)) .and() .setData().forPath(ZkPath.CONFIG_ENSEMBLE_URL.getPath(), connectionUrl.getBytes(Charsets.UTF_8))