geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [18/50] [abbrv] incubator-geode git commit: Revert "GEODE-467: fix race in off-heap memory monitor tests"
Date Thu, 05 Nov 2015 20:35:55 GMT
Revert "GEODE-467: fix race in off-heap memory monitor tests"

This reverts commit 9d8e568b4b00085b5f2cf8b7d049027211b3f7d1. This
commit was causing the dunit runs to hang in stopMonitoring.


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

Branch: refs/heads/feature/GEODE-77
Commit: 272729bbebd3c4e62acf8131df9b4cdb612c5645
Parents: 2e06f01
Author: Dan Smith <upthewaterspout@apache.org>
Authored: Wed Oct 28 14:09:10 2015 -0700
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Wed Oct 28 14:09:10 2015 -0700

----------------------------------------------------------------------
 .../cache/control/OffHeapMemoryMonitor.java     | 23 +++++---------------
 .../cache/OffHeapEvictionDUnitTest.java         |  2 +-
 ...rtitionedRegionOffHeapEvictionDUnitTest.java |  2 +-
 .../control/MemoryMonitorOffHeapJUnitTest.java  |  2 +-
 4 files changed, 8 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/272729bb/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/control/OffHeapMemoryMonitor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/control/OffHeapMemoryMonitor.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/control/OffHeapMemoryMonitor.java
index 86ccad5..c4e9df6 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/control/OffHeapMemoryMonitor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/control/OffHeapMemoryMonitor.java
@@ -59,7 +59,6 @@ public class OffHeapMemoryMonitor implements ResourceMonitor, MemoryUsageListene
   private boolean hasEvictionThreshold = false;
 
   private OffHeapMemoryUsageListener offHeapMemoryUsageListener;
-  private Thread memoryListenerThread;
   
   private final InternalResourceManager resourceManager;
   private final ResourceAdvisor resourceAdvisor;
@@ -94,12 +93,11 @@ public class OffHeapMemoryMonitor implements ResourceMonitor, MemoryUsageListene
 
       this.offHeapMemoryUsageListener = new OffHeapMemoryUsageListener(getBytesUsed());
       ThreadGroup group = LoggingThreadGroup.createThreadGroup("OffHeapMemoryMonitor Threads",
logger);
-      Thread t = new Thread(group, this.offHeapMemoryUsageListener);
-      t.setName(t.getName() + " OffHeapMemoryListener");
-      t.setPriority(Thread.MAX_PRIORITY);
-      t.setDaemon(true);
-      t.start();
-      this.memoryListenerThread = t;
+      Thread memoryListenerThread = new Thread(group, this.offHeapMemoryUsageListener);
+      memoryListenerThread.setName(memoryListenerThread.getName() + " OffHeapMemoryListener");
+      memoryListenerThread.setPriority(Thread.MAX_PRIORITY);
+      memoryListenerThread.setDaemon(true);
+      memoryListenerThread.start();
       
       this.memoryAllocator.addMemoryUsageListener(this);
       
@@ -112,9 +110,6 @@ public class OffHeapMemoryMonitor implements ResourceMonitor, MemoryUsageListene
    */
   @Override
   public void stopMonitoring() {
-    stopMonitoring(false);
-  }
-  public void stopMonitoring(boolean waitForThread) {
     synchronized (this) {
       if (!this.started) {
         return;
@@ -127,14 +122,6 @@ public class OffHeapMemoryMonitor implements ResourceMonitor, MemoryUsageListene
         this.offHeapMemoryUsageListener.notifyAll();
       }
 
-      if (waitForThread && this.memoryListenerThread != null) {
-        try {
-          this.memoryListenerThread.join();
-        } catch (InterruptedException e) {
-          Thread.currentThread().interrupt();
-        }
-      }
-      this.memoryListenerThread = null;
       this.started = false;
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/272729bb/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
index 386f8ce..57cdfae 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
@@ -78,7 +78,7 @@ public class OffHeapEvictionDUnitTest extends EvictionDUnitDisabledTest
{
       getLogWriter().info("cache= " + cache);
       getLogWriter().info("cache closed= " + cache.isClosed());
       cache.getResourceManager().setEvictionOffHeapPercentage(85);
-      ((GemFireCacheImpl) cache).getResourceManager().getOffHeapMonitor().stopMonitoring(true);
+      ((GemFireCacheImpl) cache).getResourceManager().getOffHeapMonitor().stopMonitoring();
       getLogWriter().info("eviction= "+cache.getResourceManager().getEvictionOffHeapPercentage());
       getLogWriter().info("critical= "+cache.getResourceManager().getCriticalOffHeapPercentage());
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/272729bb/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
index cd5e962..f07c5b1 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
@@ -85,7 +85,7 @@ public class PartitionedRegionOffHeapEvictionDUnitTest extends
     
     setEvictionPercentage(85);
     OffHeapMemoryMonitor ohmm = ((GemFireCacheImpl) getCache()).getResourceManager().getOffHeapMonitor();
-    ohmm.stopMonitoring(true);
+    ohmm.stopMonitoring();
 
     ohmm.updateStateAndSendEvent(94371840);
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/272729bb/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/control/MemoryMonitorOffHeapJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/control/MemoryMonitorOffHeapJUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/control/MemoryMonitorOffHeapJUnitTest.java
index bf8be0a..d7a875c 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/control/MemoryMonitorOffHeapJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/control/MemoryMonitorOffHeapJUnitTest.java
@@ -92,7 +92,7 @@ public class MemoryMonitorOffHeapJUnitTest {
     
     monitor.setEvictionThreshold(50.0f);  
     monitor.setCriticalThreshold(75.0f);
-    monitor.stopMonitoring(true);
+    monitor.stopMonitoring();
     
     assertEquals(524288, internalManager.getStats().getOffHeapEvictionThreshold());
     assertEquals(786432, internalManager.getStats().getOffHeapCriticalThreshold());


Mime
View raw message