ctubbsii commented on a change in pull request #1896:
URL: https://github.com/apache/accumulo/pull/1896#discussion_r568215173



##########
File path: core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
##########
@@ -158,13 +157,41 @@ public synchronized boolean tryLock(LockWatcher lw, 
byte[] data)
       String pathToDelete = path + "/" + createdNodeName;
       LOG.debug("[{}] Failed to acquire lock in tryLock(), deleting all at 
path: {}", vmLockPrefix,
           pathToDelete);
-      zooKeeper.recursiveDelete(pathToDelete, NodeMissingPolicy.SKIP);
+      recursiveDelete(zooKeeper, pathToDelete, NodeMissingPolicy.SKIP);
       createdNodeName = null;
     }
 
     return false;
   }
 
+  /**
+   * This method will delete a node and all its children.
+   */
+  public static void recursiveDelete(ZooKeeper zooKeeper, String zPath, 
NodeMissingPolicy policy)

Review comment:
       ZooUtil probably makes more sense for this utility, since it's not 
ZooLock-specific code.

##########
File path: core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
##########
@@ -90,21 +92,18 @@ public String toString() {
   private String createdNodeName;
   private String watchingNodeName;
 
-  public ZooLock(ZooReaderWriter zoo, String path, UUID uuid) {
-    this(new ZooCache(zoo), zoo, path, uuid);
+  public ZooLock(AccumuloConfiguration conf, String path, UUID uuid) {
+    this(conf.get(Property.INSTANCE_ZK_HOST),
+        (int) conf.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT),
+        conf.get(Property.INSTANCE_SECRET), path, uuid);
   }
 
   public ZooLock(String zookeepers, int timeInMillis, String secret, String 
path, UUID uuid) {

Review comment:
       The only place this constructor is called is in ZooLockIT, with the same 
args over and over again. It would be simpler to delete this constructor, and 
update ZooLockIT use a ConfigurationCopy instance of AccumuloConfiguration with 
the config properties already set up in a `@Before` method, so ZooLockIT can 
just use the other constructor.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to