You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/12/16 18:43:18 UTC

geode git commit: GEODE-1541 : Made statsListUniqueId to be an AtomicLong.

Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-1541 [created] 828fae721


GEODE-1541 : Made statsListUniqueId to be an AtomicLong.


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

Branch: refs/heads/feature/GEODE-1541
Commit: 828fae7219803c87345a8db10de89ed521b8cc8b
Parents: e3ec736
Author: Amey Barve <ab...@apache.org>
Authored: Thu Dec 15 13:00:25 2016 +0530
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri Dec 16 10:36:01 2016 -0800

----------------------------------------------------------------------
 .../internal/InternalDistributedSystem.java           | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/828fae72/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
index 800512d..95aa7df 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
@@ -36,6 +36,7 @@ import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 
 import org.apache.logging.log4j.Logger;
@@ -1726,8 +1727,7 @@ public class InternalDistributedSystem extends DistributedSystem
 
   private final CopyOnWriteArrayList<Statistics> statsList = new CopyOnWriteArrayList<Statistics>();
   private int statsListModCount = 0;
-  private long statsListUniqueId = 1;
-  private final Object statsListUniqueIdLock = new Object();
+  private AtomicLong statsListUniqueId = new AtomicLong(1);
 
   // As the function execution stats can be lot in number, its better to put
   // them in a map so that it will be accessible immediately
@@ -1800,10 +1800,7 @@ public class InternalDistributedSystem extends DistributedSystem
     if (this.statsDisabled) {
       return new DummyStatisticsImpl(type, textId, numericId);
     }
-    long myUniqueId;
-    synchronized (statsListUniqueIdLock) {
-      myUniqueId = statsListUniqueId++; // fix for bug 30597
-    }
+    long myUniqueId = statsListUniqueId.getAndIncrement();
     Statistics result =
         new LocalStatisticsImpl(type, textId, numericId, myUniqueId, false, osStatFlags, this);
     synchronized (statsList) {
@@ -1935,10 +1932,7 @@ public class InternalDistributedSystem extends DistributedSystem
       return new DummyStatisticsImpl(type, textId, numericId);
     }
 
-    long myUniqueId;
-    synchronized (statsListUniqueIdLock) {
-      myUniqueId = statsListUniqueId++; // fix for bug 30597
-    }
+    long myUniqueId = statsListUniqueId.getAndIncrement();
     Statistics result = StatisticsImpl.createAtomicNoOS(type, textId, numericId, myUniqueId, this);
     synchronized (statsList) {
       statsList.add(result);