dlmarion commented on code in PR #5145:
URL: https://github.com/apache/accumulo/pull/5145#discussion_r1873731118
##########
core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLock.java:
##########
@@ -762,4 +762,26 @@ public static boolean deleteLock(ZooReaderWriter zk,
ServiceLockPath path, Strin
return false;
}
+
+ /**
+ * Checks that the lock still exists in ZooKeeper. The typical mechanism for
determining if a lock
+ * is lost depends on a Watcher set on the lock node. There exists a case
where the Watcher may
+ * not get called if another Watcher is stuck waiting on I/O or otherwise
hung. In the case where
+ * this method returns false, then the typical action is to exit the server
process.
+ *
+ * @return true if lock path still exists, false otherwise and on error
+ */
+ public boolean verifyLockAtSource() {
+ if (getLockPath() == null) {
+ // lock not set yet
+ return false;
+ }
+ try {
+ return null != this.zooKeeper.exists(getLockPath(), false);
Review Comment:
I figured that it did not matter if I was using a shared ZK client in this
case as I'm not setting or relying on a watcher and instead checking to see if
the node exists on the server.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]