2
Lock.release()
ロックパスは削除されませんか?これはバグですか? 自分でパスを削除する必要がありますか?キューマネージャ:InterProcessMutex Lock.release()はロックパスを削除しませんでした
RetryPolicy retryPolicy = new RetryOneTime(1000);
CuratorFramework client =
CuratorFrameworkFactory
.builder()
.connectString(zkAddress)
.sessionTimeoutMs(ZKConstant.ZK_SESSION_TIMEOUT)
.connectionTimeoutMs(ZKConstant.ZK_CONNECTION_TIMEOUT)
.retryPolicy(retryPolicy)
.build();
client.start();
InterProcessMutex lock = new InterProcessMutex(client, "/test_lock");
if (lock.acquire(3, TimeUnit.SECONDS)) {
LOGGER.debug(curatorUtil.exists(lockPath) == null);
}
if (lock != null){
lock.release(); // After I call this method,
// the "/test_lock" node still exists. Why?
}
LOGGER.debug(curatorUtil.exists(lockPath) == null);
client.close();
} catch (Exception e) {
e.printStackTrace();
}
}
これはZooKeeperの一般的な問題です。 ZooKeeper 3.5にContainer Nodesを追加した理由です。 Curator 3.0とZooKeeper 3.5.xを使用すると、親ノードは自動的に削除されます。古いバージョンでは、Curator's ReaperとChidReaperを使用する必要があります。 – Randgalt