本文整理了Java中org.linkedin.zookeeper.client.ZKData.<init>()
方法的一些代码示例,展示了ZKData.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKData.<init>()
方法的具体详情如下:
包路径:org.linkedin.zookeeper.client.ZKData
类名称:ZKData
方法名:<init>
[英]Constructor
[中]建造师
代码示例来源:origin: org.pongasoft/org.linkedin.zookeeper-impl
/**
* Returns both the data as a byte[] as well as the stat (and sets a watcher if not null)
*/
@Override
public ZKData<byte[]> getZKByteData(String path, Watcher watcher)
throws InterruptedException, KeeperException
{
Stat stat = new Stat();
return new ZKData<byte[]>(getData(path, watcher, stat), stat);
}
代码示例来源:origin: org.fusesource.insight/insight-graph
@Override
public ZKData<OutputWriter> readData(org.linkedin.zookeeper.client.IZKClient zkClient, String path, Watcher watcher) throws InterruptedException, KeeperException {
Stat stat = new Stat();
Unmarshaller<OutputWriter> unmarshaller = null;
if (path.endsWith(".json")) {
unmarshaller = new JsonUnmarshaller<OutputWriter>(OutputWriter.class);
} else if (path.endsWith(".properties")) {
unmarshaller = new PropertiesObjectWriterUnmarshaller();
} else {
LOG.debug("Ignoring ZK Path: " + path + " as it doesn't end in .json");
return new ZKData<OutputWriter>(null, stat);
}
LOG.info("Reading ZK path: " + path + " and converting to an OutputWriter");
byte[] data = zkClient.getData(path, watcher, stat);
try {
OutputWriter outputWriter = unmarshaller.unmarshal(path, data);
if (outputWriter != null) {
configureWriter(outputWriter);
outputWriter.start();
}
return new ZKData<OutputWriter>(outputWriter, stat);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.pongasoft/org.linkedin.zookeeper-impl
/**
* Returns both the data as a string as well as the stat (and sets a watcher if not null)
*/
@Override
public ZKData<String> getZKStringData(String path, Watcher watcher)
throws InterruptedException, KeeperException
{
ZKData<byte[]> zkData = getZKByteData(path, watcher);
return new ZKData<String>(toStringData(zkData.getData()), zkData.getStat());
}
内容来源于网络,如有侵权,请联系作者删除!