You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by zh...@apache.org on 2019/10/26 00:29:40 UTC

[geode] branch feature/GEODE-6973 updated: GEODE-6973: The pdxRegion.size() should be called outside of TX context to avoid messaging.

This is an automated email from the ASF dual-hosted git repository.

zhouxj pushed a commit to branch feature/GEODE-6973
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-6973 by this push:
     new 3b834f2  GEODE-6973: The pdxRegion.size() should be called outside of TX context to avoid messaging.
3b834f2 is described below

commit 3b834f28b66787a156c0f69cb010611326f81f21
Author: zhouxh <gz...@pivotal.io>
AuthorDate: Fri Oct 25 17:25:38 2019 -0700

    GEODE-6973: The pdxRegion.size() should be called outside of TX context to avoid messaging.
    
      Co-authored-by: Anil <ag...@pivotal.io>
      Co-authored-by: Xiaojian Zhou <gz...@pivotal.io>
      Co-authored-by: Donal Evans <do...@pivotal.io>
---
 .../apache/geode/pdx/internal/PeerTypeRegistration.java   | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
index f25be75..5f78f64 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
@@ -359,7 +359,7 @@ public class PeerTypeRegistration implements TypeRegistration {
     }
     lock();
     try {
-      if (reverseMap.shouldReloadFromRegion(getIdToType())) {
+      if (shouldReload()) {
         buildReverseMapsFromRegion();
       }
       reverseMap.flushPendingReverseMap();
@@ -629,6 +629,17 @@ public class PeerTypeRegistration implements TypeRegistration {
     }
   }
 
+  boolean shouldReload() {
+    boolean shouldReload = false;
+    TXStateProxy currentState = suspendTX();
+    try {
+      shouldReload = reverseMap.shouldReloadFromRegion(getIdToType());
+    } finally {
+      resumeTX(currentState);
+    }
+    return shouldReload;
+  }
+
   @Override
   public int defineEnum(final EnumInfo newInfo) {
     statistics.enumDefined();
@@ -639,7 +650,7 @@ public class PeerTypeRegistration implements TypeRegistration {
     }
     lock();
     try {
-      if (reverseMap.shouldReloadFromRegion(getIdToType())) {
+      if (shouldReload()) {
         buildReverseMapsFromRegion();
       }
       reverseMap.flushPendingReverseMap();