This is an automated email from the ASF dual-hosted git repository.

lta pushed a commit to branch cluster
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/cluster by this push:
     new 8ed800c  modify for raft node as client manager
     new ab3c4e0  Merge branch 'cluster' of github.com:apache/incubator-iotdb 
into cluster
8ed800c is described below

commit 8ed800cc3fbbe768da12999f337c4d96fe82815d
Author: lta <[email protected]>
AuthorDate: Mon Apr 8 09:30:31 2019 +0800

    modify for raft node as client manager
---
 .../org/apache/iotdb/cluster/rpc/impl/RaftNodeAsClientManager.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/cluster/src/main/java/org/apache/iotdb/cluster/rpc/impl/RaftNodeAsClientManager.java
 
b/cluster/src/main/java/org/apache/iotdb/cluster/rpc/impl/RaftNodeAsClientManager.java
index 2851b2d..804e55c 100644
--- 
a/cluster/src/main/java/org/apache/iotdb/cluster/rpc/impl/RaftNodeAsClientManager.java
+++ 
b/cluster/src/main/java/org/apache/iotdb/cluster/rpc/impl/RaftNodeAsClientManager.java
@@ -183,6 +183,7 @@ public class RaftNodeAsClientManager {
                   @Override
                   public void onResponse(Object result) {
                     BasicResponse response = (BasicResponse) result;
+                    releaseClient();
                     qpTask.run(response);
                   }
 
@@ -190,6 +191,7 @@ public class RaftNodeAsClientManager {
                   public void onException(Throwable e) {
                     LOGGER.error("Bolt rpc client occurs errors when handling 
Request", e);
                     qpTask.setTaskState(TaskState.EXCEPTION);
+                    releaseClient();
                     qpTask.run(null);
 
                   }
@@ -201,9 +203,9 @@ public class RaftNodeAsClientManager {
                 }, TASK_TIMEOUT_MS);
       } catch (RemotingException | InterruptedException e) {
         LOGGER.error(e.getMessage());
+        releaseClient();
         throw new RaftConnectionException(e);
       }
-      releaseClient();
     }
 
     @Override
@@ -216,8 +218,9 @@ public class RaftNodeAsClientManager {
         qpTask.run(response);
       } catch (RemotingException | InterruptedException e) {
         throw new RaftConnectionException(e);
+      } finally {
+        releaseClient();
       }
-      releaseClient();
     }
 
     /**

Reply via email to