gpt4 book ai didi

org.apache.helix.manager.zk.ZkClient.readData()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 10:50:49 27 4
gpt4 key购买 nike

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

ZkClient.readData介绍

暂无

代码示例

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

public void readZNode(String path) {
 ZNRecord record = _zkclient.readData(path, true);
 if (record == null) {
  System.out.println("null");
 } else {
  System.out.println(new String(_serializer.serialize(record)));
 }
}

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

Assert.assertEquals(origIdealStatesReadTotalLatencyCounter, 0);
Assert.assertEquals((long) beanServer.getAttribute(idealStatename, "ReadLatencyGauge.Max"), 0);
zkClient.readData(TEST_PATH, new Stat());
Assert.assertEquals((long) beanServer.getAttribute(rootname, "ReadCounter"), 2);
Assert

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

public static String readZkAsBytes(ZkClient zkclient, PropertyKey propertyKey) {
 byte[] bytes = zkclient.readData(propertyKey.getPath());
 return bytes == null ? EMPTY_ZNRECORD_STRING : new String(bytes);
}

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

/**
 * sync get
 */
@Override
public T get(String path, Stat stat, int options) {
 T data = null;
 try {
  data = (T) _zkClient.readData(path, stat);
 } catch (ZkNoNodeException e) {
  if (AccessOption.isThrowExceptionIfNotExist(options)) {
   throw e;
  }
 }
 return data;
}

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

public void download(String zkPath, String fsPath) throws Exception {

  List<String> children = client.getChildren(zkPath);
  if (children != null && children.size() > 0) {
   new File(fsPath).mkdirs();
   for (String child : children) {
    String childPath = zkPath.equals("/") ? "/" + child : zkPath + "/" + child;
    download(childPath, fsPath + "/" + child);
   }
  } else {
   System.out
     .println("Saving " + zkPath + " to " + new File(fsPath + suffix).getCanonicalPath());
   OutputStream out = new FileOutputStream(fsPath + suffix);
   Object readData = client.readData(zkPath);
   if (readData != null) {
    out.write((byte[]) readData);
   }
   out.close();
  }
 }
}

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

retKeys = zkClient.getChildren(splits[0]);
} else {
 ZNRecord record = zkClient.readData(splits[0]);

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

ZnodeOpArg arg = _command._znodeOpArg;
final String znodePath = arg._znodePath;
ZNRecord record = _zkClient.<ZNRecord> readData(znodePath, true);

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

if (oldStat == null) {
 newRoot.stat = newStat;
 newRoot.data = _zkClient.<T> readData(path, true);
 dataChanged = true;
} else if (newStat.equals(oldStat)) {
 dataChanged = true;
 newRoot.stat = newStat;
 newRoot.data = _zkClient.<T> readData(path, true);

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

private ZNRecord getConfigZnRecord(HelixConfigScope scope) {
 String clusterName = scope.getClusterName();
 if (!ZKUtil.isClusterSetup(clusterName, zkClient)) {
  throw new HelixException("fail to get configs. cluster " + clusterName + " is not setup yet");
 }
 return zkClient.readData(scope.getZkPath(), true);
}

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

ZNRecord record = zkClient.readData(zkPath);
if (mapKey == null) {
 retKeys = new ArrayList<String>(record.getSimpleFields().keySet());
 ZNRecord record = zkClient.readData(zkPath);
 retKeys = new ArrayList<String>(record.getMapFields().keySet());
} else {

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

String[] splits = scopeStr.split("\\|");
ZNRecord record = zkClient.readData(splits[0], true);

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

try {
 Stat readStat = new Stat();
 T oldData = (T) _zkClient.readData(path, readStat);
 T newData = updater.update(oldData);
 if (newData != null) {

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

ZNRecord record = zkClient.readData("/" + testName);
Assert.assertEquals(record.getId(), testName);
try {
 zkClient = ZKClientPool.getZkClient(zkAddr);
 record = zkClient.readData("/" + testName);
 Assert.fail("should fail on zk no node exception");
} catch (ZkNoNodeException e) {
record = zkClient.readData("/" + testName);
Assert.assertEquals(record.getId(), testName);

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

if (client.exists(path)) {
 if (mergeOnUpdate) {
  ZNRecord curRecord = client.readData(path);
  if (curRecord != null) {
   curRecord.merge(record);

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

ZNRecord record = _zkclient.readData(liveInstancePath, stat, true);
if (record == null) {

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

public void post(String zkServer, Message message, String clusterName, String instanceName) {
 ZkClient client = new ZkClient(zkServer);
 client.setZkSerializer(new ZNRecordSerializer());
 String path = PropertyPathBuilder.instanceMessage(clusterName, instanceName, message.getId());
 client.delete(path);
 ZNRecord record = client.readData(PropertyPathBuilder.liveInstance(clusterName, instanceName));
 message.setTgtSessionId(record.getSimpleField(LiveInstanceProperty.SESSION_ID.toString()));
 message.setTgtName(record.getId());
 // System.out.println(message);
 client.createPersistent(path, message.getRecord());
}

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