You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2018/05/29 19:22:40 UTC

[03/14] hbase git commit: HBASE-20597 Serialize access to a shared reference to ZooKeeperWatcher in HBaseReplicationEndpoint

HBASE-20597 Serialize access to a shared reference to ZooKeeperWatcher in HBaseReplicationEndpoint


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

Branch: refs/heads/branch-1.3
Commit: 405a30404bde4e6256f20542008a25e33b6b732e
Parents: 8e79429
Author: Andrew Purtell <ap...@apache.org>
Authored: Fri May 25 10:25:29 2018 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Tue May 29 11:23:26 2018 -0700

----------------------------------------------------------------------
 .../hbase/replication/HBaseReplicationEndpoint.java       | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/405a3040/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java
index 6485e4a..6d3e70e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java
@@ -43,19 +43,17 @@ import org.apache.zookeeper.KeeperException.SessionExpiredException;
  * target cluster is an HBase cluster.
  */
 @InterfaceAudience.Private
-@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="MT_CORRECTNESS",
-  justification="Thinks zkw needs to be synchronized access but should be fine as is.")
 public abstract class HBaseReplicationEndpoint extends BaseReplicationEndpoint
   implements Abortable {
 
   private static final Log LOG = LogFactory.getLog(HBaseReplicationEndpoint.class);
 
-  private ZooKeeperWatcher zkw = null; // FindBugs: MT_CORRECTNESS
+  private ZooKeeperWatcher zkw = null;
 
   private List<ServerName> regionServers = new ArrayList<ServerName>(0);
   private long lastRegionServerUpdate;
 
-  protected void disconnect() {
+  protected synchronized void disconnect() {
     if (zkw != null) {
       zkw.close();
     }
@@ -113,7 +111,7 @@ public abstract class HBaseReplicationEndpoint extends BaseReplicationEndpoint
    * Get the ZK connection to this peer
    * @return zk connection
    */
-  protected ZooKeeperWatcher getZkw() {
+  protected synchronized ZooKeeperWatcher getZkw() {
     return zkw;
   }
 
@@ -121,7 +119,7 @@ public abstract class HBaseReplicationEndpoint extends BaseReplicationEndpoint
    * Closes the current ZKW (if not null) and creates a new one
    * @throws IOException If anything goes wrong connecting
    */
-  void reloadZkWatcher() throws IOException {
+  synchronized void reloadZkWatcher() throws IOException {
     if (zkw != null) zkw.close();
     zkw = new ZooKeeperWatcher(ctx.getConfiguration(),
         "connection to cluster: " + ctx.getPeerId(), this);