GEODE-642: fix race in OffHeapStorageJUnitTest

The problem was caused by the listener not rechecking the system
property every time it was notified of an OutOfOffHeapMemoryException.
Since the code that disconnects the distributed system when
we run out of off-heap memory is async the test would intermittently pass.


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

Branch: refs/heads/feature/GEODE-291
Commit: 80b59bfa3dcf9b2ac1317c6996591b1fd68494e1
Parents: a6398d9
Author: Darrel Schneider <[email protected]>
Authored: Tue Dec 8 10:42:58 2015 -0800
Committer: Darrel Schneider <[email protected]>
Committed: Tue Dec 8 11:36:25 2015 -0800

----------------------------------------------------------------------
 .../com/gemstone/gemfire/internal/offheap/OffHeapStorage.java     | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80b59bfa/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStorage.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStorage.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStorage.java
index 82cbfeb..3eb839b 100755
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStorage.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStorage.java
@@ -395,7 +395,6 @@ public class OffHeapStorage implements OffHeapMemoryStats {
   }
   
   static class DisconnectingOutOfOffHeapMemoryListener implements 
OutOfOffHeapMemoryListener {
-    private final boolean stayConnectedOnOutOfOffHeapMemory = 
Boolean.getBoolean(STAY_CONNECTED_ON_OUTOFOFFHEAPMEMORY_PROPERTY);
     private final Object lock = new Object();
     private InternalDistributedSystem ids;
     
@@ -415,7 +414,7 @@ public class OffHeapStorage implements OffHeapMemoryStats {
         if (this.ids == null) {
           return;
         }
-        if (stayConnectedOnOutOfOffHeapMemory) {
+        if (Boolean.getBoolean(STAY_CONNECTED_ON_OUTOFOFFHEAPMEMORY_PROPERTY)) 
{
           return;
         }
         

Reply via email to