Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7C64C200BE1 for ; Mon, 19 Dec 2016 09:42:11 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7B078160B21; Mon, 19 Dec 2016 08:42:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C64E0160B18 for ; Mon, 19 Dec 2016 09:42:10 +0100 (CET) Received: (qmail 80573 invoked by uid 500); 19 Dec 2016 08:42:10 -0000 Mailing-List: contact commits-help@geode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.apache.org Delivered-To: mailing list commits@geode.apache.org Received: (qmail 80564 invoked by uid 99); 19 Dec 2016 08:42:10 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Dec 2016 08:42:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D064CDFB77; Mon, 19 Dec 2016 08:42:09 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: abarve@apache.org To: commits@geode.apache.org Message-Id: <35ac170deab74423af4f267cec3244a7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: geode git commit: GEODE-1541 : Made statsListUniqueId to be an AtomicLong. This closes #319 Date: Mon, 19 Dec 2016 08:42:09 +0000 (UTC) archived-at: Mon, 19 Dec 2016 08:42:11 -0000 Repository: geode Updated Branches: refs/heads/develop fc89d7410 -> c02feccf7 GEODE-1541 : Made statsListUniqueId to be an AtomicLong. This closes #319 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/c02feccf Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/c02feccf Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/c02feccf Branch: refs/heads/develop Commit: c02feccf7f73931e751b541c74a6729141ae02fd Parents: fc89d74 Author: Amey Barve Authored: Thu Dec 15 13:00:25 2016 +0530 Committer: Amey Barve Committed: Mon Dec 19 14:10:36 2016 +0530 ---------------------------------------------------------------------- .../internal/InternalDistributedSystem.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/c02feccf/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 statsList = new CopyOnWriteArrayList(); 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);