33
33
import org .apache .accumulo .core .conf .SiteConfiguration ;
34
34
import org .apache .accumulo .core .data .InstanceId ;
35
35
import org .apache .accumulo .core .fate .zookeeper .ServiceLock ;
36
- import org .apache .accumulo .core .fate .zookeeper .ZooCache ;
37
36
import org .apache .accumulo .core .fate .zookeeper .ZooReader ;
37
+ import org .apache .accumulo .core .fate .zookeeper .ZooSession ;
38
+ import org .apache .zookeeper .ZooKeeper ;
38
39
import org .slf4j .Logger ;
39
40
import org .slf4j .LoggerFactory ;
40
41
@@ -84,23 +85,23 @@ static synchronized void listInstances(String keepers, boolean printAll, boolean
84
85
85
86
System .out .println ("INFO : Using ZooKeepers " + keepers );
86
87
ZooReader rdr = new ZooReader (keepers , ZOOKEEPER_TIMER_MILLIS );
87
- ZooCache cache = new ZooCache ( rdr , null );
88
+ ZooKeeper zk = ZooSession . getAnonymousSession ( keepers , ZOOKEEPER_TIMER_MILLIS );
88
89
89
90
TreeMap <String ,InstanceId > instanceNames = getInstanceNames (rdr , printErrors );
90
91
91
92
System .out .println ();
92
93
printHeader ();
93
94
94
95
for (Entry <String ,InstanceId > entry : instanceNames .entrySet ()) {
95
- printInstanceInfo (cache , entry .getKey (), entry .getValue (), printErrors );
96
+ printInstanceInfo (zk , entry .getKey (), entry .getValue (), printErrors );
96
97
}
97
98
98
99
TreeSet <InstanceId > instancedIds = getInstanceIDs (rdr , printErrors );
99
100
instancedIds .removeAll (instanceNames .values ());
100
101
101
102
if (printAll ) {
102
103
for (InstanceId uuid : instancedIds ) {
103
- printInstanceInfo (cache , null , uuid , printErrors );
104
+ printInstanceInfo (zk , null , uuid , printErrors );
104
105
}
105
106
} else if (!instancedIds .isEmpty ()) {
106
107
System .out .println ();
@@ -140,9 +141,9 @@ private static void printHeader() {
140
141
141
142
}
142
143
143
- private static void printInstanceInfo (ZooCache cache , String instanceName , InstanceId iid ,
144
+ private static void printInstanceInfo (ZooKeeper zk , String instanceName , InstanceId iid ,
144
145
boolean printErrors ) {
145
- String manager = getManager (cache , iid , printErrors );
146
+ String manager = getManager (zk , iid , printErrors );
146
147
if (instanceName == null ) {
147
148
instanceName = "" ;
148
149
}
@@ -155,7 +156,7 @@ private static void printInstanceInfo(ZooCache cache, String instanceName, Insta
155
156
"\" " + instanceName + "\" " , iid , manager );
156
157
}
157
158
158
- private static String getManager (ZooCache cache , InstanceId iid , boolean printErrors ) {
159
+ private static String getManager (ZooKeeper zk , InstanceId iid , boolean printErrors ) {
159
160
160
161
if (iid == null ) {
161
162
return null ;
@@ -164,7 +165,7 @@ private static String getManager(ZooCache cache, InstanceId iid, boolean printEr
164
165
try {
165
166
var zLockManagerPath =
166
167
ServiceLock .path (Constants .ZROOT + "/" + iid + Constants .ZMANAGER_LOCK );
167
- byte [] manager = ServiceLock .getLockData (cache , zLockManagerPath , null );
168
+ byte [] manager = ServiceLock .getLockData (zk , zLockManagerPath );
168
169
if (manager == null ) {
169
170
return null ;
170
171
}
0 commit comments