accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [1/3] git commit: ACCUMULO-1920 should not close shared zookeeper session; clean up unused watcher list
Date Mon, 25 Nov 2013 21:44:33 GMT
Updated Branches:
  refs/heads/master ff651a706 -> 77a4f5a49


ACCUMULO-1920 should not close shared zookeeper session; clean up unused watcher list

Conflicts:
	server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java


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

Branch: refs/heads/master
Commit: f896c9566c9a483bcf7d074efce16b1f1c88ed2c
Parents: c175bd3
Author: Eric Newton <eric.newton@gmail.com>
Authored: Fri Nov 22 14:50:02 2013 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Mon Nov 25 16:28:38 2013 -0500

----------------------------------------------------------------------
 .../accumulo/fate/zookeeper/ZooSession.java     | 14 -----------
 .../apache/accumulo/server/monitor/Monitor.java | 25 +++++++++-----------
 2 files changed, 11 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f896c956/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 4854d49..7258ff0 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());
       }
@@ -131,7 +118,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/f896c956/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java b/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
index fc2f98a..3904088 100644
--- a/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
+++ b/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
@@ -417,21 +417,18 @@ 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(), SecurityConstants.getSystemCredentials());
-          } 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(), SecurityConstants.getSystemCredentials());
+        } 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