geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aging...@apache.org
Subject [geode] 01/01: GEODE-3190 Changed test hook to be volatile, added additional log to diagnose the issue.
Date Fri, 15 Sep 2017 19:19:54 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit b1e89d530efc7c9230cc09595f992e06ed2b733f
Author: Anil <agingade@pivotal.io>
AuthorDate: Fri Sep 15 12:18:29 2017 -0700

    GEODE-3190 Changed test hook to be volatile, added additional log to diagnose the issue.
---
 .../org/apache/geode/internal/cache/AbstractRegionMap.java  |  2 +-
 .../org/apache/geode/internal/cache/Bug48182JUnitTest.java  | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
index 40c8b07..dbcf9b7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
@@ -93,7 +93,7 @@ public abstract class AbstractRegionMap implements RegionMap {
    * This test hook is used to force the conditions for defect 48182. This hook is used by
    * Bug48182JUnitTest.
    */
-  static Runnable testHookRunnableFor48182 = null;
+  static volatile Runnable testHookRunnableFor48182 = null;
 
   private RegionEntryFactory entryFactory;
 
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug48182JUnitTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug48182JUnitTest.java
index 61bc5a4..c6a3354 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug48182JUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug48182JUnitTest.java
@@ -161,6 +161,8 @@ public class Bug48182JUnitTest {
       // e.printStackTrace();
       fail("Did not receive a CacheClosedException.  Received a " + e.getClass().getName()
           + " instead.");
+    } finally {
+      AbstractRegionMap.testHookRunnableFor48182 = null;
     }
 
     assertTrue("A CacheClosedException was not triggered", correctException);
@@ -177,7 +179,14 @@ public class Bug48182JUnitTest {
     AbstractRegionMap.testHookRunnableFor48182 = new Runnable() {
       @Override
       public void run() {
-        getCache().getRegion(getRegionName()).destroyRegion();
+        Cache cache = getCache();
+        Region region = cache.getRegion(getRegionName());
+        region.destroyRegion();
+        if (cache.getLogger() != null) {
+          cache.getLogger()
+              .info("Region " + getRegionName() + " is destroyed : " + region.isDestroyed());
+        }
+        assertTrue("Region " + getRegionName() + " is not destroyed.", region.isDestroyed());
       }
     };
 
@@ -196,6 +205,8 @@ public class Bug48182JUnitTest {
       // e.printStackTrace();
       fail("Did not receive a RegionDestroyedException.  Received a " + e.getClass().getName()
           + " instead.");
+    } finally {
+      AbstractRegionMap.testHookRunnableFor48182 = null;
     }
 
     assertTrue("A RegionDestroyedException was not triggered", correctException);

-- 
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <commits@geode.apache.org>.

Mime
View raw message