【发布时间】:2018-09-21 12:28:54
【问题描述】:
我正在使用 CuratorFramework 4.0.0 和 Zookeper 3.5.4。 我有这个代码sn-p:
RetryPolicy retryPolicy = new RetryOneTime(1000);
client = CuratorFrameworkFactory.newClient(zkConnectionString, retryPolicy);
client.start();
String path = "/node/test_lock";
client.createContainers(path);
InterProcessSemaphoreMutex lock = new InterProcessSemaphoreMutex(client, path);
if (lock.acquire(3, TimeUnit.MILLISECONDS)) {
LOGGER.debug(client.exists(lockPath) == null);
}
if (lock != null){
lock.release(); // After I call this method,
// the "/node/test_lock" node still exists.
}
使用zookeeper 3.5版本,锁路径不应该自动删除?我错过了什么?
谢谢!
【问题讨论】:
标签: apache-zookeeper apache-curator