diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ListInstances.java b/server/base/src/main/java/org/apache/accumulo/server/util/ListInstances.java index e65a5e02a61..76a37505fab 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/ListInstances.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/ListInstances.java @@ -33,7 +33,6 @@ import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.conf.SiteConfiguration; import org.apache.accumulo.core.data.InstanceId; -import org.apache.accumulo.core.fate.zookeeper.ZooCache; import org.apache.accumulo.core.fate.zookeeper.ZooReader; import org.apache.accumulo.core.fate.zookeeper.ZooUtil; import org.apache.accumulo.core.lock.ServiceLock; @@ -92,7 +91,6 @@ static synchronized void listInstances(String keepers, boolean printAll, boolean try (var zk = new ZooSession(ListInstances.class.getSimpleName(), keepers, ZOOKEEPER_TIMER_MILLIS, null)) { ZooReader rdr = zk.asReader(); - ZooCache cache = new ZooCache(zk); TreeMap instanceNames = getInstanceNames(rdr, printErrors); @@ -100,7 +98,7 @@ static synchronized void listInstances(String keepers, boolean printAll, boolean printHeader(); for (Entry entry : instanceNames.entrySet()) { - printInstanceInfo(cache, entry.getKey(), entry.getValue(), printErrors); + printInstanceInfo(zk, entry.getKey(), entry.getValue(), printErrors); } TreeSet instancedIds = getInstanceIDs(rdr, printErrors); @@ -108,7 +106,7 @@ static synchronized void listInstances(String keepers, boolean printAll, boolean if (printAll) { for (InstanceId uuid : instancedIds) { - printInstanceInfo(cache, null, uuid, printErrors); + printInstanceInfo(zk, null, uuid, printErrors); } } else if (!instancedIds.isEmpty()) { System.out.println(); @@ -149,9 +147,9 @@ private static void printHeader() { } - private static void printInstanceInfo(ZooCache cache, String instanceName, InstanceId iid, + private static void printInstanceInfo(ZooSession zs, String instanceName, InstanceId iid, boolean printErrors) { - String manager = getManager(cache, iid, printErrors); + String manager = getManager(zs, iid, printErrors); if (instanceName == null) { instanceName = ""; } @@ -164,7 +162,7 @@ private static void printInstanceInfo(ZooCache cache, String instanceName, Insta "\"" + instanceName + "\"", iid, manager); } - private static String getManager(ZooCache cache, InstanceId iid, boolean printErrors) { + private static String getManager(ZooSession zs, InstanceId iid, boolean printErrors) { if (iid == null) { return null; @@ -173,7 +171,7 @@ private static String getManager(ZooCache cache, InstanceId iid, boolean printEr try { var zLockManagerPath = ServiceLockPaths.parse(Optional.of(Constants.ZMANAGER_LOCK), ZooUtil.getRoot(iid) + Constants.ZMANAGER_LOCK); - Optional sld = ServiceLock.getLockData(cache, zLockManagerPath, null); + Optional sld = ServiceLock.getLockData(zs, zLockManagerPath); if (sld.isEmpty()) { return null; }