gpt4 book ai didi

org.I0Itec.zkclient.ZkClient.writeDataReturnStat()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 11:22:40 25 4
gpt4 key购买 nike

本文整理了Java中org.I0Itec.zkclient.ZkClient.writeDataReturnStat()方法的一些代码示例,展示了ZkClient.writeDataReturnStat()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkClient.writeDataReturnStat()方法的具体详情如下:
包路径:org.I0Itec.zkclient.ZkClient
类名称:ZkClient
方法名:writeDataReturnStat

ZkClient.writeDataReturnStat介绍

暂无

代码示例

代码示例来源:origin: com.101tec/zkclient

public void writeData(final String path, Object datat, final int expectedVersion) {
  writeDataReturnStat(path, datat, expectedVersion);
}

代码示例来源:origin: confluentinc/common

ConditionalUpdateCallback customConditionCallback) {
try {
 Stat stat = client.writeDataReturnStat(path, data, expectedVersion);
 log.debug(
   "Conditional update of path %s with value %s and expected version %d succeeded, returning the new version: %d"

代码示例来源:origin: org.apache.samza/samza-core_2.11

/**
 * publish the version number of the next JobModel
 * @param oldVersion - used to validate, that no one has changed the version in the meanwhile.
 * @param newVersion - new version.
 */
public void publishJobModelVersion(String oldVersion, String newVersion) {
 Stat stat = new Stat();
 String currentVersion = zkClient.readData(keyBuilder.getJobModelVersionPath(), stat);
 metrics.reads.inc();
 LOG.info("publishing new version: " + newVersion + "; oldVersion = " + oldVersion + "(" + stat
   .getVersion() + ")");
 if (currentVersion != null && !currentVersion.equals(oldVersion)) {
  throw new SamzaException(
    "Someone changed JobModelVersion while the leader was generating one: expected" + oldVersion + ", got " + currentVersion);
 }
 // data version is the ZK version of the data from the ZK.
 int dataVersion = stat.getVersion();
 try {
  stat = zkClient.writeDataReturnStat(keyBuilder.getJobModelVersionPath(), newVersion, dataVersion);
  metrics.writes.inc();
 } catch (Exception e) {
  String msg = "publish job model version failed for new version = " + newVersion + "; old version = " + oldVersion;
  LOG.error(msg, e);
  throw new SamzaException(msg, e);
 }
 LOG.info("published new version: " + newVersion + "; expected data version = " + (dataVersion + 1) +
   "(actual data version after update = " + stat.getVersion() + ")");
}

代码示例来源:origin: org.apache.samza/samza-core_2.10

/**
 * publish the version number of the next JobModel
 * @param oldVersion - used to validate, that no one has changed the version in the meanwhile.
 * @param newVersion - new version.
 */
public void publishJobModelVersion(String oldVersion, String newVersion) {
 Stat stat = new Stat();
 String currentVersion = zkClient.readData(keyBuilder.getJobModelVersionPath(), stat);
 metrics.reads.inc();
 LOG.info("publishing new version: " + newVersion + "; oldVersion = " + oldVersion + "(" + stat
   .getVersion() + ")");
 if (currentVersion != null && !currentVersion.equals(oldVersion)) {
  throw new SamzaException(
    "Someone changed JobModelVersion while the leader was generating one: expected" + oldVersion + ", got " + currentVersion);
 }
 // data version is the ZK version of the data from the ZK.
 int dataVersion = stat.getVersion();
 try {
  stat = zkClient.writeDataReturnStat(keyBuilder.getJobModelVersionPath(), newVersion, dataVersion);
  metrics.writes.inc();
 } catch (Exception e) {
  String msg = "publish job model version failed for new version = " + newVersion + "; old version = " + oldVersion;
  LOG.error(msg, e);
  throw new SamzaException(msg, e);
 }
 LOG.info("published new version: " + newVersion + "; expected data version = " + (dataVersion + 1) +
   "(actual data version after update = " + stat.getVersion() + ")");
}

代码示例来源:origin: apache/samza

/**
 * publish the version number of the next JobModel
 * @param oldVersion - used to validate, that no one has changed the version in the meanwhile.
 * @param newVersion - new version.
 */
public void publishJobModelVersion(String oldVersion, String newVersion) {
 Stat stat = new Stat();
 String currentVersion = zkClient.readData(keyBuilder.getJobModelVersionPath(), stat);
 metrics.reads.inc();
 LOG.info("publishing new version: " + newVersion + "; oldVersion = " + oldVersion + "(" + stat
   .getVersion() + ")");
 if (currentVersion != null && !currentVersion.equals(oldVersion)) {
  throw new SamzaException(
    "Someone changed JobModelVersion while the leader was generating one: expected" + oldVersion + ", got " + currentVersion);
 }
 // data version is the ZK version of the data from the ZK.
 int dataVersion = stat.getVersion();
 try {
  stat = zkClient.writeDataReturnStat(keyBuilder.getJobModelVersionPath(), newVersion, dataVersion);
  metrics.writes.inc();
 } catch (Exception e) {
  String msg = "publish job model version failed for new version = " + newVersion + "; old version = " + oldVersion;
  LOG.error(msg, e);
  throw new SamzaException(msg, e);
 }
 LOG.info("published new version: " + newVersion + "; expected data version = " + (dataVersion + 1) +
   "(actual data version after update = " + stat.getVersion() + ")");
}

代码示例来源:origin: org.apache.samza/samza-core

/**
 * publish the version number of the next JobModel
 * @param oldVersion - used to validate, that no one has changed the version in the meanwhile.
 * @param newVersion - new version.
 */
public void publishJobModelVersion(String oldVersion, String newVersion) {
 Stat stat = new Stat();
 String currentVersion = zkClient.readData(keyBuilder.getJobModelVersionPath(), stat);
 metrics.reads.inc();
 LOG.info("publishing new version: " + newVersion + "; oldVersion = " + oldVersion + "(" + stat
   .getVersion() + ")");
 if (currentVersion != null && !currentVersion.equals(oldVersion)) {
  throw new SamzaException(
    "Someone changed JobModelVersion while the leader was generating one: expected" + oldVersion + ", got " + currentVersion);
 }
 // data version is the ZK version of the data from the ZK.
 int dataVersion = stat.getVersion();
 try {
  stat = zkClient.writeDataReturnStat(keyBuilder.getJobModelVersionPath(), newVersion, dataVersion);
  metrics.writes.inc();
 } catch (Exception e) {
  String msg = "publish job model version failed for new version = " + newVersion + "; old version = " + oldVersion;
  LOG.error(msg, e);
  throw new SamzaException(msg, e);
 }
 LOG.info("published new version: " + newVersion + "; expected data version = " + (dataVersion + 1) +
   "(actual data version after update = " + stat.getVersion() + ")");
}

代码示例来源:origin: org.apache.samza/samza-core_2.12

/**
 * publish the version number of the next JobModel
 * @param oldVersion - used to validate, that no one has changed the version in the meanwhile.
 * @param newVersion - new version.
 */
public void publishJobModelVersion(String oldVersion, String newVersion) {
 Stat stat = new Stat();
 String currentVersion = zkClient.readData(keyBuilder.getJobModelVersionPath(), stat);
 metrics.reads.inc();
 LOG.info("publishing new version: " + newVersion + "; oldVersion = " + oldVersion + "(" + stat
   .getVersion() + ")");
 if (currentVersion != null && !currentVersion.equals(oldVersion)) {
  throw new SamzaException(
    "Someone changed JobModelVersion while the leader was generating one: expected" + oldVersion + ", got " + currentVersion);
 }
 // data version is the ZK version of the data from the ZK.
 int dataVersion = stat.getVersion();
 try {
  stat = zkClient.writeDataReturnStat(keyBuilder.getJobModelVersionPath(), newVersion, dataVersion);
  metrics.writes.inc();
 } catch (Exception e) {
  String msg = "publish job model version failed for new version = " + newVersion + "; old version = " + oldVersion;
  LOG.error(msg, e);
  throw new SamzaException(msg, e);
 }
 LOG.info("published new version: " + newVersion + "; expected data version = " + (dataVersion + 1) +
   "(actual data version after update = " + stat.getVersion() + ")");
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com