You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2017/03/07 19:22:03 UTC
[40/51] [abbrv] geode git commit: Improved colocatedByList by getting
rid of unneeded synchronization and making the field final.
Improved colocatedByList by getting rid of unneeded synchronization
and making the field final.
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/d6761a15
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/d6761a15
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/d6761a15
Branch: refs/heads/feature/GEM-1195
Commit: d6761a15be375be8a07c9af9a3a4034a6d658984
Parents: 5b78f5d
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Wed Mar 1 16:46:36 2017 -0800
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Wed Mar 1 16:46:36 2017 -0800
----------------------------------------------------------------------
.../apache/geode/cache/query/internal/DefaultQuery.java | 4 ++--
.../apache/geode/internal/cache/PartitionedRegion.java | 12 ++++--------
2 files changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/d6761a15/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java
index 8bfd4fa..a721091 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java
@@ -650,8 +650,8 @@ public class DefaultQuery implements Query {
continue;
}
other = allPRs;
- if ((((PartitionedRegion) eachPR).colocatedByList.contains(allPRs)
- || ((PartitionedRegion) allPRs).colocatedByList.contains(eachPR))) {
+ if ((((PartitionedRegion) eachPR).getColocatedByList().contains(allPRs)
+ || ((PartitionedRegion) allPRs).getColocatedByList().contains(eachPR))) {
colocated = true;
break;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d6761a15/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index 7bc6e97..588bc33 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -600,7 +600,7 @@ public class PartitionedRegion extends LocalRegion
private byte fixedPASet;
- public List<PartitionedRegion> colocatedByList = new CopyOnWriteArrayList<PartitionedRegion>();
+ private final List<PartitionedRegion> colocatedByList = new CopyOnWriteArrayList<PartitionedRegion>();
private final PartitionListener[] partitionListeners;
@@ -670,9 +670,7 @@ public class PartitionedRegion extends LocalRegion
this.colocatedWithRegion = ColocationHelper.getColocatedRegion(this);
if (colocatedWithRegion != null) {
- synchronized (colocatedWithRegion.colocatedByList) {
- colocatedWithRegion.colocatedByList.add(this);
- }
+ colocatedWithRegion.getColocatedByList().add(this);
}
if (colocatedWithRegion != null && !internalRegionArgs.isUsedForParallelGatewaySenderQueue()) {
@@ -786,7 +784,7 @@ public class PartitionedRegion extends LocalRegion
return parallelGatewaySenderIds;
}
- List<PartitionedRegion> getColocatedByList() {
+ public List<PartitionedRegion> getColocatedByList() {
return this.colocatedByList;
}
@@ -7912,9 +7910,7 @@ public class PartitionedRegion extends LocalRegion
}
}
if (colocatedWithRegion != null) {
- synchronized (colocatedWithRegion.colocatedByList) {
- colocatedWithRegion.colocatedByList.remove(this);
- }
+ colocatedWithRegion.getColocatedByList().remove(this);
}
RegionLogger.logDestroy(getName(), cache.getMyId(), null, op.isClose());