geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [21/26] incubator-geode git commit: GEODE-1607: Fix ConcurrentModificationException during cache close
Date Thu, 30 Jun 2016 19:23:26 GMT
GEODE-1607: Fix ConcurrentModificationException during cache close


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

Branch: refs/heads/feature/GEODE-1571
Commit: 186a09a74b202a4943ced37eddd258e7906d117f
Parents: ee05774
Author: eshu <eshu@pivotal.io>
Authored: Thu Jun 30 11:11:28 2016 -0700
Committer: eshu <eshu@pivotal.io>
Committed: Thu Jun 30 11:12:59 2016 -0700

----------------------------------------------------------------------
 .../gemstone/gemfire/internal/cache/TXManagerImpl.java   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/186a09a7/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
index 1512234..dc668eb 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
@@ -583,8 +583,15 @@ public class TXManagerImpl implements CacheTransactionManager,
     if (isClosed()) {
       return;
     }
-    this.closed = true;
-    for (TXStateProxy proxy: this.hostedTXStates.values()) {
+    TXStateProxy[] proxies = null;
+    synchronized (this.hostedTXStates) {
+      //After this, newly added TXStateProxy would not operate on the TXState.
+      this.closed = true;
+      
+      proxies = this.hostedTXStates.values().toArray(new TXStateProxy[this.hostedTXStates.size()]);
     
+    }
+    
+    for (TXStateProxy proxy: proxies) {
       proxy.getLock().lock();
       try {
         proxy.close();


Mime
View raw message