asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mb...@apache.org
Subject incubator-asterixdb git commit: SONAR: Synchronization On Boxed Primitives
Date Tue, 17 May 2016 15:50:36 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master e5bff31d5 -> bba05b7bb


SONAR: Synchronization On Boxed Primitives

Synchronization should not be based on Strings or boxed primitives

Fixes:
 - https://asterix-sonar.ics.uci.edu/issues/search#issues=AVR98lUKuXNBBqjTzg_N
 - https://asterix-sonar.ics.uci.edu/issues/search#issues=AVR98lUKuXNBBqjTzg_O
 - https://asterix-sonar.ics.uci.edu/issues/search#issues=AVR98lUKuXNBBqjTzg_P

Change-Id: I520582cb5a03d775d696ec5b4390b571322e18f7
Reviewed-on: https://asterix-gerrit.ics.uci.edu/853
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>


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

Branch: refs/heads/master
Commit: bba05b7bbad0a9d9be38fd14dcd0409505695d7b
Parents: e5bff31
Author: Michael Blow <mblow@apache.org>
Authored: Mon May 16 14:21:30 2016 -0700
Committer: Michael Blow <michael.blow@couchbase.com>
Committed: Tue May 17 08:50:36 2016 -0700

----------------------------------------------------------------------
 .../apache/asterix/event/service/ClusterStateWatcher.java   | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bba05b7b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ClusterStateWatcher.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ClusterStateWatcher.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ClusterStateWatcher.java
index 2ef8697..f823404 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ClusterStateWatcher.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ClusterStateWatcher.java
@@ -25,8 +25,8 @@ import org.apache.zookeeper.ZooKeeper;
 
 //A zookeeper watcher that watches the change in the state of the cluster
 public class ClusterStateWatcher implements Watcher {
-    private static Integer mutex;
-    private static ZooKeeper zk;
+    private final Object mutex = new Object();
+    private final ZooKeeper zk;
     private String clusterStatePath;
     private boolean done = false;
     private ClusterState clusterState = ClusterState.STARTING;
@@ -35,12 +35,9 @@ public class ClusterStateWatcher implements Watcher {
     private static Logger LOGGER = Logger.getLogger(ClusterStateWatcher.class.getName());
 
     public ClusterStateWatcher(ZooKeeper zk, String clusterName) {
-        if (mutex == null) {
-            mutex = new Integer(-1);
-        }
         this.clusterStatePath = ZooKeeperService.ASTERIX_INSTANCE_BASE_PATH + File.separator
+ clusterName
                 + ZooKeeperService.ASTERIX_INSTANCE_STATE_PATH;
-        ClusterStateWatcher.zk = zk;
+        this.zk = zk;
     }
 
     public ClusterState waitForClusterStart() throws Exception {


Mime
View raw message