Repository: hbase
Updated Branches:
  refs/heads/branch-1.0 cabae4b58 -> 51116cf20


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/51116cf2
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/51116cf2
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/51116cf2

Branch: refs/heads/branch-1.0
Commit: 51116cf20ccba53d14baf00f6aa44a25f1723167
Parents: cabae4b
Author: stack <[email protected]>
Authored: Tue Dec 23 12:20:30 2014 -0800
Committer: stack <[email protected]>
Committed: Tue Dec 23 12:31:26 2014 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/51116cf2/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
----------------------------------------------------------------------
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
index af879d7e..407d37b 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
@@ -55,6 +55,7 @@ public class ZooKeeperWatcher implements Watcher, Abortable, 
Closeable {
 
   // 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
@@ -156,9 +157,10 @@ public class ZooKeeperWatcher implements Watcher, 
Abortable, Closeable {
       this.constructorCaller = e;
     }
     this.quorum = ZKConfig.getZKQuorumServersString(conf);
+    this.prefix = identifier;
     // Identifier will get the sessionid appended later below down when we
     // handle the syncconnect event.
-    this.identifier = identifier;
+    this.identifier = identifier + "0x0";
     this.abortable = abortable;
     setNodeNames(conf);
     this.recoverableZooKeeper = ZKUtil.connect(conf, quorum, this, identifier);
@@ -389,7 +391,7 @@ public class ZooKeeperWatcher implements Watcher, 
Abortable, Closeable {
             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");

Reply via email to