org.apache.twill.zookeeper.ZKClient.setData()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(107)

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

ZKClient.setData介绍

[英]Sets the data for the given path without matching version. Same as calling #setData(String,byte[],int).
[中]设置给定路径的数据,但不匹配版本。与调用#setData(字符串,字节[],int)相同。

代码示例

代码示例来源:origin: org.apache.twill/twill-zookeeper

@Override
public OperationFuture<Stat> setData(String dataPath, byte[] data, int version) {
 return delegate.setData(dataPath, data, version);
}

代码示例来源:origin: org.apache.twill/twill-zookeeper

@Override
public OperationFuture<Stat> setData(String dataPath, byte[] data, int version) {
 return client.setData(dataPath, data, version);
}

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

@Override
public OperationFuture<Stat> setData(String dataPath, byte[] data, int version) {
 return delegate.setData(dataPath, data, version);
}

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

@Override
public OperationFuture<Stat> setData(String dataPath, byte[] data, int version) {
 return client.setData(dataPath, data, version);
}

代码示例来源:origin: caskdata/coopr

@Override
 public void onFailure(Throwable t) {
  if (causedBy(t, KeeperException.NodeExistsException.class)) {
   OperationFuture<Stat> setDataResult = zkClient.setData(path, data);
   Futures.addCallback(setDataResult, new FutureCallback<Stat>() {
    @Override
    public void onSuccess(Stat result) {
     resultFuture.set(new SetResult(null, result));
    }
    @Override
    public void onFailure(Throwable t) {
     if (causedBy(t, KeeperException.NoNodeException.class)) {
      Futures.addCallback(zkClient.create(path, data, createMode, createParent), createCallback);
      return;
     }
     resultFuture.setException(t);
    }
   });
   return;
  }
  resultFuture.setException(t);
 }
});

代码示例来源:origin: caskdata/cdap

try {
 final T data = dataSupplier.get();
 Futures.addCallback(zkClient.setData(path, codec.encode(data)), new FutureCallback<Stat>() {
  @Override
  public void onSuccess(Stat state) {

代码示例来源:origin: co.cask.cdap/cdap-common

try {
 final T data = dataSupplier.get();
 Futures.addCallback(zkClient.setData(path, codec.encode(data)), new FutureCallback<Stat>() {
  @Override
  public void onSuccess(Stat state) {

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

/**
 * Update the live node for the service.
 *
 * @return A {@link OperationFuture} that will be completed when the update is done.
 */
protected final OperationFuture<?> updateLiveNode() {
 String liveNodePath = getLiveNodePath();
 LOG.info("Update live node {}{}", zkClient.getConnectString(), liveNodePath);
 return zkClient.setData(liveNodePath, serializeLiveNode());
}

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

/**
 * Update the live node for the service.
 *
 * @return A {@link OperationFuture} that will be completed when the update is done.
 */
protected final OperationFuture<?> updateLiveNode() {
 String liveNodePath = getLiveNodePath();
 LOG.info("Update live node {}{}", zkClient.getConnectString(), liveNodePath);
 return zkClient.setData(liveNodePath, serializeLiveNode());
}

代码示例来源:origin: caskdata/coopr

private long generateId(Type type) {
 idLock.get().lock();
 try {
  NodeData nodeData = Futures.getUnchecked(zkClient.getData(type.path));
  long counterVal = Longs.fromByteArray(nodeData.getData());
  Futures.getUnchecked(zkClient.setData(type.path, Longs.toByteArray(counterVal + incrementBy)));
  return counterVal;
 } finally {
  idLock.get().unlock();
 }
}

代码示例来源:origin: org.apache.twill/twill-zookeeper

@Override
public OperationFuture<Stat> setData(String dataPath, byte[] data, int version) {
 return relayFuture(delegate.setData(getNamespacedPath(dataPath), data, version), this.<Stat>createFuture(dataPath));
}

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

@Override
public OperationFuture<Stat> setData(String dataPath, byte[] data, int version) {
 return relayFuture(delegate.setData(getNamespacedPath(dataPath), data, version), this.<Stat>createFuture(dataPath));
}

相关文章