Repository: hbase
Updated Branches:
  refs/heads/0.94 597d57b9e -> d93ea9461


HBASE-12739 Avoid too large identifier of ZooKeeperWatcher (Liu Shaohui)


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

Branch: refs/heads/0.94
Commit: d93ea946146321fd7357ace83b9a0b0558fe605f
Parents: 597d57b
Author: stack <[email protected]>
Authored: Tue Dec 23 12:40:22 2014 -0800
Committer: stack <[email protected]>
Committed: Tue Dec 23 12:40:22 2014 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/d93ea946/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java 
b/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
index 81081d5..bca28e8 100644
--- a/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
+++ b/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
@@ -56,6 +56,7 @@ public class ZooKeeperWatcher implements Watcher, Abortable {
 
   // Identifier for this watcher (for logging only).  It is made of the prefix
   // passed on construction and the zookeeper sessionid.
+  private String prefix;
   private String identifier;
 
   // zookeeper quorum
@@ -147,7 +148,8 @@ public class ZooKeeperWatcher implements Watcher, Abortable 
{
     this.quorum = ZKConfig.getZKQuorumServersString(conf);
     // Identifier will get the sessionid appended later below down when we
     // handle the syncconnect event.
-    this.identifier = descriptor;
+    this.prefix = descriptor;
+    this.identifier = descriptor + "0x0";
     this.abortable = abortable;
     setNodeNames(conf);
     this.recoverableZooKeeper = ZKUtil.connect(conf, quorum, this, descriptor);
@@ -365,7 +367,7 @@ public class ZooKeeperWatcher implements Watcher, Abortable 
{
             this.constructorCaller);
           throw new NullPointerException("ZK is null");
         }
-        this.identifier = this.identifier + "-0x" +
+        this.identifier = this.prefix + "-0x" +
           Long.toHexString(this.recoverableZooKeeper.getSessionId());
         // Update our identifier.  Otherwise ignore.
         LOG.debug(this.identifier + " connected");
@@ -459,7 +461,7 @@ public class ZooKeeperWatcher implements Watcher, Abortable 
{
   public void abort(String why, Throwable e) {
     this.abortable.abort(why, e);
   }
-  
+
   @Override
   public boolean isAborted() {
     return this.abortable.isAborted();

Reply via email to