use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.Stat in project lightconf by haifeiWu.
the class XxlConfZkClient method getPathDataByKey.
/**
* get data from node
* @param key
* @return
*/
public static String getPathDataByKey(String key) {
String path = keyToPath(key);
try {
Stat stat = getInstance().exists(path, true);
if (stat != null) {
String znodeValue = null;
byte[] resultData = getInstance().getData(path, true, null);
if (resultData != null) {
znodeValue = new String(resultData);
}
return znodeValue;
} else {
logger.info(">>>>>>>>>> xxl conf, znodeKey[{}] not found.", key);
}
} catch (KeeperException e) {
logger.error(e.getMessage(), e);
} catch (InterruptedException e) {
logger.error(e.getMessage(), e);
}
return null;
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.Stat in project fabric8 by jboss-fuse.
the class ZooKeeperGroup method internalRebuildNode.
private void internalRebuildNode(String fullPath) throws Exception {
try {
Stat stat = new Stat();
byte[] bytes = client.getData().storingStatIn(stat).forPath(fullPath);
currentData.put(fullPath, new ChildData<T>(fullPath, stat, bytes, decode(bytes)));
} catch (KeeperException.NoNodeException ignore) {
// node no longer exists - remove it
currentData.remove(fullPath);
}
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.Stat in project fabric8 by jboss-fuse.
the class ZooKeeperGroupTest method putChildData.
private static void putChildData(ZooKeeperGroup<NodeState> group, String path, String container) throws Exception {
NodeState node = new NodeState("test", container);
ByteArrayOutputStream data = new ByteArrayOutputStream();
new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).writeValue(data, node);
ChildData<NodeState> child = new ChildData<>(path, new Stat(), data.toByteArray(), node);
group.currentData.put(path, child);
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.Stat in project fabric8 by jboss-fuse.
the class TreeCacheExtended method getDataAndStat.
void getDataAndStat(final String fullPath) throws Exception {
if (client.checkExists().forPath(fullPath) == null) {
return;
}
final List<String> children = client.getChildren().usingWatcher(watcher).forPath(fullPath);
if (cacheData) {
Stat stat = new Stat();
byte[] data = null;
if (dataIsCompressed) {
data = client.getData().decompressed().storingStatIn(stat).usingWatcher(watcher).forPath(fullPath);
} else {
data = client.getData().storingStatIn(stat).usingWatcher(watcher).forPath(fullPath);
}
applyNewData(fullPath, KeeperException.Code.OK.intValue(), stat, data, children);
} else {
Stat stat = client.checkExists().usingWatcher(watcher).forPath(fullPath);
applyNewData(fullPath, KeeperException.Code.OK.intValue(), stat, null, children);
}
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.Stat in project fabric8 by jboss-fuse.
the class NodeCacheExtended method internalRebuild.
private void internalRebuild() throws Exception {
try {
Stat stat = new Stat();
byte[] bytes = dataIsCompressed ? client.getData().decompressed().storingStatIn(stat).forPath(path) : client.getData().storingStatIn(stat).forPath(path);
data.set(new ChildData(path, stat, bytes));
} catch (KeeperException.NoNodeException e) {
data.set(null);
}
}
Aggregations