accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [3/6] git commit: ACCUMULO-1920 should not close shared zookeeper session; clean up unused watcher list
Date Fri, 22 Nov 2013 20:59:19 GMT
ACCUMULO-1920 should not close shared zookeeper session; clean up unused watcher list


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 11acdf86d05ee512c056e846311c1c3fb8d432dd
Parents: eec1292
Author: Eric Newton <eric.newton@gmail.com>
Authored: Fri Nov 22 14:50:02 2013 -0500
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Fri Nov 22 15:58:54 2013 -0500

----------------------------------------------------------------------
 .../accumulo/fate/zookeeper/ZooSession.java     | 14 ------------
 .../org/apache/accumulo/monitor/Monitor.java    | 24 ++++++++------------
 2 files changed, 10 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/11acdf86/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
----------------------------------------------------------------------
diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
index b02fbd3..64e1fc5 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
@@ -18,10 +18,7 @@ package org.apache.accumulo.fate.zookeeper;
 
 import java.io.IOException;
 import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Map;
 
 import org.apache.accumulo.fate.util.UtilWaitThread;
@@ -52,17 +49,7 @@ class ZooSession {
   
   private static class ZooWatcher implements Watcher {
     
-    private HashSet<Watcher> watchers = new HashSet<Watcher>();
-    
     public void process(WatchedEvent event) {
-      // copy the watchers, in case the callback adds() more Watchers
-      // otherwise we get a ConcurrentModificationException
-      Collection<Watcher> watcherCopy = new ArrayList<Watcher>(watchers);
-      
-      for (Watcher watcher : watcherCopy) {
-        watcher.process(event);
-      }
-      
       if (event.getState() == KeeperState.Expired) {
         log.debug("Session expired, state of current session : " + event.getState());
       }
@@ -138,7 +125,6 @@ class ZooSession {
     
     // a read-only session can use a session with authorizations, so cache a copy for it
w/out auths
     String readOnlySessionKey = sessionKey(zooKeepers, timeout, null, null);
-    
     ZooSessionInfo zsi = sessions.get(sessionKey);
     if (zsi != null && zsi.zooKeeper.getState() == States.CLOSED) {
       if (auth != null && sessions.get(readOnlySessionKey) == zsi)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/11acdf86/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
index 0ccae17..bce6461 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
@@ -363,21 +363,17 @@ public class Monitor {
     try {
       // Read the gc location from its lock
       ZooReaderWriter zk = ZooReaderWriter.getInstance();
-      try {
-        String path = ZooUtil.getRoot(instance) + Constants.ZGC_LOCK;
-        List<String> locks = zk.getChildren(path, null);
-        if (locks != null && locks.size() > 0) {
-          Collections.sort(locks);
-          address = new ServerServices(new String(zk.getData(path + "/" + locks.get(0), null))).getAddress(Service.GC_CLIENT);
-          GCMonitorService.Client client = ThriftUtil.getClient(new GCMonitorService.Client.Factory(),
address, config.getConfiguration());
-          try {
-            result = client.getStatus(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance));
-          } finally {
-            ThriftUtil.returnClient(client);
-          }
+      String path = ZooUtil.getRoot(instance) + Constants.ZGC_LOCK;
+      List<String> locks = zk.getChildren(path, null);
+      if (locks != null && locks.size() > 0) {
+        Collections.sort(locks);
+        address = new ServerServices(new String(zk.getData(path + "/" + locks.get(0), null))).getAddress(Service.GC_CLIENT);
+        GCMonitorService.Client client = ThriftUtil.getClient(new GCMonitorService.Client.Factory(),
address, config.getConfiguration());
+        try {
+          result = client.getStatus(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance));
+        } finally {
+          ThriftUtil.returnClient(client);
         }
-      } finally {
-        zk.close();
       }
     } catch (Exception ex) {
       log.warn("Unable to contact the garbage collector at " + address, ex);


Mime
View raw message