Repository: tajo
Updated Branches:
  refs/heads/master 048af99fd -> 333b6f784


TAJO-1569: BlockingRpcClient can make other request fail. (jinho)

Closes #541


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/333b6f78
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/333b6f78
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/333b6f78

Branch: refs/heads/master
Commit: 333b6f784a7f237752f5d93b9235b2468aea3471
Parents: 048af99
Author: Jinho Kim <[email protected]>
Authored: Sat Apr 18 17:12:49 2015 +0900
Committer: Jinho Kim <[email protected]>
Committed: Sat Apr 18 17:12:49 2015 +0900

----------------------------------------------------------------------
 CHANGES                                             |  2 ++
 .../java/org/apache/tajo/rpc/BlockingRpcClient.java |  7 ++++---
 .../java/org/apache/tajo/rpc/TestBlockingRpc.java   | 16 ++++++++++++++++
 3 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/333b6f78/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 0569ace..10dee67 100644
--- a/CHANGES
+++ b/CHANGES
@@ -96,6 +96,8 @@ Release 0.11.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1569: BlockingRpcClient can make other request fail. (jinho)
+
     TAJO-1564: TestFetcher fails occasionally. (jinho)
 
     TAJO-1497: RPC client does not share a connection. (jinho)

http://git-wip-us.apache.org/repos/asf/tajo/blob/333b6f78/tajo-rpc/tajo-rpc-protobuf/src/main/java/org/apache/tajo/rpc/BlockingRpcClient.java
----------------------------------------------------------------------
diff --git 
a/tajo-rpc/tajo-rpc-protobuf/src/main/java/org/apache/tajo/rpc/BlockingRpcClient.java
 
b/tajo-rpc/tajo-rpc-protobuf/src/main/java/org/apache/tajo/rpc/BlockingRpcClient.java
index c98f91f..ad536a4 100644
--- 
a/tajo-rpc/tajo-rpc-protobuf/src/main/java/org/apache/tajo/rpc/BlockingRpcClient.java
+++ 
b/tajo-rpc/tajo-rpc-protobuf/src/main/java/org/apache/tajo/rpc/BlockingRpcClient.java
@@ -77,7 +77,7 @@ public class BlockingRpcClient extends NettyClientBase {
       callback.setFailed("BlockingRpcClient terminates all the connections",
           new ServiceException("BlockingRpcClient terminates all the 
connections"));
     }
-
+    requests.clear();
     super.close();
   }
 
@@ -169,7 +169,6 @@ public class BlockingRpcClient extends NettyClientBase {
         if (rpcResponse.hasErrorMessage()) {
           callback.setFailed(rpcResponse.getErrorMessage(),
               makeTajoServiceException(rpcResponse, new 
ServiceException(rpcResponse.getErrorTrace())));
-          throw new 
RemoteException(getErrorMessage(rpcResponse.getErrorMessage()));
         } else {
           Message responseMessage;
 
@@ -188,10 +187,12 @@ public class BlockingRpcClient extends NettyClientBase {
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
         throws Exception {
+      /* Current requests will be failed */
       for(ProtoCallFuture callback: requests.values()) {
         callback.setFailed(cause.getMessage(), cause);
       }
-      
+      requests.clear();
+
       if(LOG.isDebugEnabled()) {
         LOG.error("" + cause.getMessage(), cause);
       } else {

http://git-wip-us.apache.org/repos/asf/tajo/blob/333b6f78/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
----------------------------------------------------------------------
diff --git 
a/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
 
b/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
index c114985..568eb63 100644
--- 
a/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
+++ 
b/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
@@ -218,6 +218,22 @@ public class TestBlockingRpc {
   }
 
   @Test
+  public void testThrowException2() throws Exception {
+    EchoMessage message = EchoMessage.newBuilder()
+        .setMessage(MESSAGE).build();
+
+    try {
+      stub.throwException(null, message);
+      fail("RpcCall should throw exception");
+    } catch (Throwable t) {
+      assertTrue(t instanceof TajoServiceException);
+    }
+
+    EchoMessage message1 = stub.deley(null, message);
+    assertEquals(message, message1);
+  }
+
+  @Test
   @SetupRpcConnection(setupRpcServer=false,setupRpcClient=false)
   public void testConnectionRetry() throws Exception {
     retries = 10;

Reply via email to