You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2011/12/27 18:03:13 UTC

svn commit: r1224947 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java

Author: tedyu
Date: Tue Dec 27 17:03:13 2011
New Revision: 1224947

URL: http://svn.apache.org/viewvc?rev=1224947&view=rev
Log:
HBASE-5073  Registered listeners not getting removed leading to memory leak in HBaseAdmin
               (Ramkrishna)

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1224947&r1=1224946&r2=1224947&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Tue Dec 27 17:03:13 2011
@@ -8,6 +8,8 @@ Release 0.90.6 - Unreleased
    HBASE-4893  HConnectionImplementation is closed but not deleted (Mubarak)
    HBASE-4970  Add a parameter so that keepAliveTime of Htable thread pool can be changed (gaojinchao)
    HBASE-5060  HBase client is blocked forever (Jinchao)
+   HBASE-5073  Registered listeners not getting removed leading to memory leak in HBaseAdmin
+               (Ramkrishna)
 
 Release 0.90.5 - Dec 22, 2011
   BUG FIXES

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java?rev=1224947&r1=1224946&r2=1224947&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java Tue Dec 27 17:03:13 2011
@@ -75,6 +75,7 @@ public class CatalogTracker {
   private HServerAddress metaLocation;
   private final int defaultTimeout;
   private boolean stopped = false;
+  private boolean instantiatedzkw = false;
   private HConnection abortable;
 
   public static final byte [] ROOT_REGION =
@@ -133,7 +134,15 @@ public class CatalogTracker {
   throws IOException {
     this.conf = conf;
     this.connection = connection;
-    this.zookeeper = (zk == null) ? this.connection.getZooKeeperWatcher() : zk;
+    if (zk == null) {
+      // Create our own.  Set flag so we tear it down on stop.
+      this.zookeeper =
+        new ZooKeeperWatcher(conf, "catalogtracker-on-" + connection.toString(),
+          abortable);
+      instantiatedzkw = true;
+    } else {
+      this.zookeeper = zk;
+    }
     if (abortable == null) {
       this.abortable = this.connection;
     }
@@ -190,6 +199,9 @@ public class CatalogTracker {
         // IOException}, in reality, the implementation would never do that.
         LOG.error("Attempt to close catalog tracker's connection failed.", e);
       }
+      if (this.instantiatedzkw) {
+        this.zookeeper.close();
+      }
       // Call this and it will interrupt any ongoing waits on meta.
       synchronized (this.metaAvailable) {
         this.metaAvailable.notifyAll();