accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [1/3] git commit: ACCUMULO-1903 prefer the cached, reusable ZooReaderWriter over raw Zookeeper API
Date Tue, 19 Nov 2013 15:31:42 GMT
Updated Branches:
  refs/heads/1.6.0-SNAPSHOT 437da6ec6 -> 55016d776


ACCUMULO-1903 prefer the cached, reusable ZooReaderWriter over raw Zookeeper API


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/32b6b657
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/32b6b657
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/32b6b657

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 32b6b65766a695b8da76bdee36df13baace6f904
Parents: 79d686f
Author: Eric Newton <eric.newton@gmail.com>
Authored: Tue Nov 19 10:13:35 2013 -0500
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Tue Nov 19 10:13:35 2013 -0500

----------------------------------------------------------------------
 .../org/apache/accumulo/server/monitor/Monitor.java  | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/32b6b657/src/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
----------------------------------------------------------------------
diff --git a/src/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java b/src/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
index c60ac47..178d4f9 100644
--- a/src/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
+++ b/src/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
@@ -29,7 +29,6 @@ import java.util.Map.Entry;
 import java.util.Set;
 
 import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.MasterClient;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.gc.thrift.GCMonitorService;
@@ -69,10 +68,8 @@ import org.apache.accumulo.server.problems.ProblemType;
 import org.apache.accumulo.server.security.SecurityConstants;
 import org.apache.accumulo.server.security.SecurityUtil;
 import org.apache.accumulo.server.util.EmbeddedWebServer;
+import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.log4j.Logger;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
 
 /**
  * Serve master statistics with an embedded web server.
@@ -399,19 +396,13 @@ public class Monitor {
     GCStatus result = null;
     try {
       // Read the gc location from its lock
-      Instance instance = HdfsZooInstance.getInstance();
-      String zooKeepers = instance.getZooKeepers();
-      log.debug("connecting to zookeepers " + zooKeepers);
-      ZooKeeper zk = new ZooKeeper(zooKeepers, (int) ServerConfiguration.getSystemConfiguration().getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT),
new Watcher() {
-        @Override
-        public void process(WatchedEvent event) {}
-      });
+      ZooReaderWriter zk = ZooReaderWriter.getInstance();
       try {
         String path = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZGC_LOCK;
         List<String> locks = zk.getChildren(path, null);
         if (locks != null && locks.size() > 0) {
           Collections.sort(locks);
-          InetSocketAddress address = new ServerServices(new String(zk.getData(path + "/"
+ locks.get(0), null, null))).getAddress(Service.GC_CLIENT);
+          InetSocketAddress address = new ServerServices(new String(zk.getData(path + "/"
+ locks.get(0), null))).getAddress(Service.GC_CLIENT);
           GCMonitorService.Iface client = ThriftUtil.getClient(new GCMonitorService.Client.Factory(),
address, ServerConfiguration.getSystemConfiguration());
           try {
             result = client.getStatus(null, SecurityConstants.getSystemCredentials());


Mime
View raw message