geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject incubator-geode git commit: GEODE-275: fix race in testRegionExpirationAfterMutate
Date Tue, 25 Aug 2015 16:18:05 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop eeb7ae177 -> 39d35daaf


GEODE-275: fix race in testRegionExpirationAfterMutate


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

Branch: refs/heads/develop
Commit: 39d35daaf6993edd197a95c1325af9326ab3728e
Parents: eeb7ae1
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Mon Aug 24 16:20:43 2015 -0700
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Mon Aug 24 16:20:43 2015 -0700

----------------------------------------------------------------------
 .../gemstone/gemfire/internal/tcp/MsgOutputStream.java |  4 ++--
 .../com/gemstone/gemfire/cache30/RegionTestCase.java   | 13 ++++++++++---
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39d35daa/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/MsgOutputStream.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/MsgOutputStream.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/MsgOutputStream.java
index 9ef54d7..5827ce5 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/MsgOutputStream.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/MsgOutputStream.java
@@ -13,8 +13,8 @@ import com.gemstone.gemfire.DataSerializer;
 import com.gemstone.gemfire.internal.*;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 
-/** MsgOutputStream is deprecated. MsgStreamer should be used instead.
- * The one non-deprecated use is in Connection for the handshake.
+/** MsgOutputStream should no longer be used except in Connection
+ * to do the handshake. Otherwise MsgStreamer should always be used.
 
  @author Darrel
  @since 3.0

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39d35daa/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java
index c063a55..4b20b42 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java
@@ -3767,9 +3767,16 @@ public abstract class RegionTestCase extends CacheTestCase {
       region.getAttributesMutator().setRegionIdleTimeout(new ExpirationAttributes(999000/*ms*/,
ExpirationAction.INVALIDATE));
       expiryTask = region.getRegionIdleExpiryTask();
       long hugeExpiryTime = expiryTask.getExpirationTime();
-      region.getAttributesMutator().setRegionIdleTimeout(new ExpirationAttributes(20/*ms*/,
ExpirationAction.INVALIDATE));
-      expiryTask = region.getRegionIdleExpiryTask();
-      long shortExpiryTime = expiryTask.getExpirationTime();
+      ExpiryTask.suspendExpiration();
+      long shortExpiryTime;
+      try {
+        region.getAttributesMutator().setRegionIdleTimeout(new ExpirationAttributes(20/*ms*/,
ExpirationAction.INVALIDATE));
+        expiryTask = region.getRegionIdleExpiryTask();
+        shortExpiryTime = expiryTask.getExpirationTime();
+        } 
+      finally {
+        ExpiryTask.permitExpiration();
+      }
       waitForInvalidate(entry, tilt+20, 10);
       assertTrue("expected hugeExpiryTime=" + hugeExpiryTime + " to be > than mediumExpiryTime="
+ mediumExpiryTime, (hugeExpiryTime - mediumExpiryTime) > 0);
       assertTrue("expected mediumExpiryTime=" + mediumExpiryTime + " to be > than shortExpiryTime="
+ shortExpiryTime, (mediumExpiryTime - shortExpiryTime) > 0);


Mime
View raw message