hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject git commit: HBASE-11923 Potential race condition in RecoverableZookeeper.checkZk() (Lars Hofhansl)
Date Wed, 10 Sep 2014 01:52:24 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.94 1130af64a -> 045f41888


HBASE-11923 Potential race condition in RecoverableZookeeper.checkZk() (Lars Hofhansl)


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

Branch: refs/heads/0.94
Commit: 045f41888ac51130b8696498ac51704eb9395046
Parents: 1130af6
Author: Enis Soztutar <enis@apache.org>
Authored: Tue Sep 9 18:52:19 2014 -0700
Committer: Enis Soztutar <enis@apache.org>
Committed: Tue Sep 9 18:52:19 2014 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/045f4188/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java b/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java
index ef95622..93ba930 100644
--- a/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java
+++ b/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java
@@ -70,7 +70,7 @@ import org.apache.zookeeper.proto.SetDataRequest;
 public class RecoverableZooKeeper {
   private static final Log LOG = LogFactory.getLog(RecoverableZooKeeper.class);
   // the actual ZooKeeper client instance
-  private volatile ZooKeeper zk;
+  private ZooKeeper zk;
   private final RetryCounterFactory retryCounterFactory;
   // An identifier of this process in the cluster
   private final String identifier;
@@ -114,7 +114,7 @@ public class RecoverableZooKeeper {
    * @return The created Zookeeper connection object
    * @throws KeeperException
    */
-  protected ZooKeeper checkZk() throws KeeperException {
+  protected synchronized ZooKeeper checkZk() throws KeeperException {
     if (this.zk == null) {
       try {
         this.zk = new ZooKeeper(quorumServers, sessionTimeout, watcher);
@@ -126,7 +126,7 @@ public class RecoverableZooKeeper {
     return zk;
   }
 
-  public void reconnectAfterExpiration()
+  public synchronized void reconnectAfterExpiration()
         throws IOException, KeeperException, InterruptedException {
     if (zk != null) {
       LOG.info("Closing dead ZooKeeper connection, session" +


Mime
View raw message