本文整理了Java中com.github.zkclient.ZkClient.exists()
方法的一些代码示例,展示了ZkClient.exists()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkClient.exists()
方法的具体详情如下:
包路径:com.github.zkclient.ZkClient
类名称:ZkClient
方法名:exists
暂无
代码示例来源:origin: adyliu/jafka
public static void makeSurePersistentPathExists(ZkClient zkClient, String path) {
if (!zkClient.exists(path)) {
zkClient.createPersistent(path, true);
}
}
代码示例来源:origin: com.github.adyliu/zkclient
@Override
public List<String> call() throws Exception {
exists(path, true);
try {
return getChildren(path, true);
} catch (ZkNoNodeException e) {
// ignore, the "exists" watch will listen for the parent node to appear
}
return null;
}
});
代码示例来源:origin: adyliu/zkclient
@Override
public List<String> call() throws Exception {
exists(path, true);
try {
return getChildren(path, true);
} catch (ZkNoNodeException e) {
// ignore, the "exists" watch will listen for the parent node to appear
}
return null;
}
});
代码示例来源:origin: adyliu/zkclient
public boolean exists(final String path) {
return exists(path, hasListeners(path));
}
代码示例来源:origin: com.github.adyliu/zkclient
public boolean exists(final String path) {
return exists(path, hasListeners(path));
}
代码示例来源:origin: com.github.adyliu/zkclient
@Override
public void run() throws Exception {
// reinstall watch
exists(path, true);
try {
byte[] data = readData(path, null, true);
listener.handleDataChange(path, data);
} catch (ZkNoNodeException e) {
listener.handleDataDeleted(path);
}
}
});
代码示例来源:origin: adyliu/zkclient
@Override
public void run() throws Exception {
// reinstall watch
exists(path, true);
try {
byte[] data = readData(path, null, true);
listener.handleDataChange(path, data);
} catch (ZkNoNodeException e) {
listener.handleDataDeleted(path);
}
}
});
代码示例来源:origin: com.github.adyliu/zkclient
@Override
public void run() throws Exception {
try {
// if the node doesn't exist we should listen for the root node to reappear
exists(path);
List<String> children = getChildren(path);
listener.handleChildChange(path, children);
} catch (ZkNoNodeException e) {
listener.handleChildChange(path, null);
}
}
});
代码示例来源:origin: com.github.adyliu/zkclient
public boolean waitUntilExists(String path, TimeUnit timeUnit, long time) throws ZkInterruptedException {
Date timeout = new Date(System.currentTimeMillis() + timeUnit.toMillis(time));
LOG.debug("Waiting until znode '" + path + "' becomes available.");
if (exists(path)) {
return true;
}
acquireEventLock();
try {
while (!exists(path, true)) {
boolean gotSignal = getEventLock().getZNodeEventCondition().awaitUntil(timeout);
if (!gotSignal) {
return false;
}
}
return true;
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} finally {
getEventLock().unlock();
}
}
代码示例来源:origin: adyliu/zkclient
@Override
public void run() throws Exception {
try {
// if the node doesn't exist we should listen for the root node to reappear
exists(path);
List<String> children = getChildren(path);
listener.handleChildChange(path, children);
} catch (ZkNoNodeException e) {
listener.handleChildChange(path, null);
}
}
});
代码示例来源:origin: adyliu/zkclient
public boolean waitUntilExists(String path, TimeUnit timeUnit, long time) throws ZkInterruptedException {
Date timeout = new Date(System.currentTimeMillis() + timeUnit.toMillis(time));
LOG.debug("Waiting until znode '" + path + "' becomes available.");
if (exists(path)) {
return true;
}
acquireEventLock();
try {
while (!exists(path, true)) {
boolean gotSignal = getEventLock().getZNodeEventCondition().awaitUntil(timeout);
if (!gotSignal) {
return false;
}
}
return true;
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} finally {
getEventLock().unlock();
}
}
内容来源于网络,如有侵权,请联系作者删除!