void releaseLock(String lockPath) throws Exception{
revocable.set(null);
// 删除临时顺序节点,只会触发后一顺序节点去获取锁,理论上不存在竞争,只排队,非抢占,公平锁,先到先得
deleteOurPath(lockPath);
}
// Class:LockInternals
private void deleteOurPath(String ourPath) throws Exception{
try{
// 后台不断尝试删除
client.delete().guaranteed().forPath(ourPath);
} catch ( KeeperException.NoNodeException e ) {
// 已经删除(可能会话过期导致),不做处理
// 实际使用Curator-2.12.0时,并不会抛出该异常
}
}