geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject incubator-geode git commit: GEODE-542: Send a function response after a CancelException
Date Wed, 11 Nov 2015 20:26:31 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-542 [created] a25a662b6


GEODE-542: Send a function response after a CancelException

There was a catch clause of a CancelException that was causing us not to
reply to a function call if a CacheClosedException was thrown from the
function. That caused as hang waiting for replies.


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

Branch: refs/heads/feature/GEODE-542
Commit: a25a662b6e0117b79c0f1987ecf34fd94e73dda1
Parents: 79aa0be
Author: Dan Smith <upthewaterspout@apache.org>
Authored: Wed Nov 11 12:24:16 2015 -0800
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Wed Nov 11 12:26:06 2015 -0800

----------------------------------------------------------------------
 .../cache/MemberFunctionStreamingMessage.java   |  9 ----
 .../MemberFunctionExecutionDUnitTest.java       | 47 ++++++++++++++++++++
 2 files changed, 47 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a25a662b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/MemberFunctionStreamingMessage.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/MemberFunctionStreamingMessage.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/MemberFunctionStreamingMessage.java
index 9ea6f28..a40a99d 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/MemberFunctionStreamingMessage.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/MemberFunctionStreamingMessage.java
@@ -209,15 +209,6 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
implemen
       replyWithException(dm, rex);
       // thr = functionException.getCause();
     }
-    catch (CancelException exception) {
-      // bug 37026: this is too noisy...
-      // throw new CacheClosedException("remote system shutting down");
-      // thr = se; cache is closed, no point trying to send a reply
-      thr = null;
-      if (logger.isDebugEnabled()) {
-        logger.debug("shutdown caught, abandoning message: {}",exception.getMessage(), exception);
-      }
-    }
     catch (Exception exception) {
       if (logger.isDebugEnabled()) {
         logger.debug("Exception occured on remote member while executing Function: {}", this.functionObject.getId(),
exception);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a25a662b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
index 129cd18..403d317 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
@@ -25,7 +25,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 
+import com.gemstone.gemfire.cache.CacheClosedException;
+import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.cache.execute.Execution;
 import com.gemstone.gemfire.cache.execute.Function;
 import com.gemstone.gemfire.cache.execute.FunctionAdapter;
@@ -46,6 +49,8 @@ import com.gemstone.gemfire.internal.cache.functions.TestFunction;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 
 import dunit.Host;
+import dunit.SerializableCallable;
+import dunit.SerializableRunnable;
 import dunit.VM;
 
 public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
@@ -300,6 +305,48 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
     member1.invoke(MemberFunctionExecutionDUnitTest.class, "bug41118");
   }
   
+  public void testOnMembersWithoutCache()
+      throws Exception {
+    DistributedMember member1Id = (DistributedMember) member1.invoke(new SerializableCallable()
{
+      
+      @Override
+      public Object call() {
+        disconnectFromDS();
+        return getSystem().getDistributedMember();
+      }
+    });
+    
+    member2.invoke(new SerializableRunnable() {
+      
+      @Override
+      public void run() {
+        getSystem();
+        ResultCollector<?, ?> rc = FunctionService.onMember(member1Id).execute(new
FunctionAdapter() {
+          
+          @Override
+          public String getId() {
+            return getClass().getName();
+          }
+          
+          @Override
+          public void execute(FunctionContext context) {
+            //This will throw an exception because the cache is not yet created.
+            CacheFactory.getAnyInstance();
+          }
+        });
+        
+        try {
+          rc.getResult(30, TimeUnit.SECONDS);
+        } catch (Exception e) {
+          if(!(e.getCause() instanceof CacheClosedException)) {
+            fail("failed", e);
+          }
+        }
+        
+      }
+    });
+  }
+  
   public static void bug41118(){
     ds = new MemberFunctionExecutionDUnitTest("temp").getSystem();
     assertNotNull(ds);


Mime
View raw message