hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkey...@apache.org
Subject git commit: HBASE-11851 RpcClient can try to close a connection not ready to close
Date Fri, 29 Aug 2014 12:36:45 GMT
Repository: hbase
Updated Branches:
  refs/heads/master beeb540f6 -> 8c0e5dca7


HBASE-11851 RpcClient can try to close a connection not ready to close


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/8c0e5dca
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8c0e5dca
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8c0e5dca

Branch: refs/heads/master
Commit: 8c0e5dca75955ad948d706d8f4f849615501eaeb
Parents: beeb540
Author: Nicolas Liochon <nkeywal@gmail.com>
Authored: Fri Aug 29 14:35:57 2014 +0200
Committer: Nicolas Liochon <nkeywal@gmail.com>
Committed: Fri Aug 29 14:35:57 2014 +0200

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/ipc/RpcClient.java  | 52 +++++++++-----------
 1 file changed, 24 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/8c0e5dca/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java
index 0262462..369b1f5 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java
@@ -732,39 +732,35 @@ public class RpcClient {
       // beware of the concurrent access to the calls list: we can add calls, but as well
       //  remove them.
       long waitUntil = EnvironmentEdgeManager.currentTimeMillis() + minIdleTimeBeforeClose;
-      while (!shouldCloseConnection.get() && running.get() &&
-          EnvironmentEdgeManager.currentTimeMillis() < waitUntil && calls.isEmpty())
{
-        wait(Math.min(minIdleTimeBeforeClose, 1000));
-      }
 
-      if (shouldCloseConnection.get()) {
-        return false;
-      }
+      while (true) {
+        if (shouldCloseConnection.get()) {
+          return false;
+        }
 
-      if (!running.get()) {
-        markClosed(new IOException("stopped with " + calls.size() + " pending request(s)"));
-        return false;
-      }
+        if (!running.get()) {
+          markClosed(new IOException("stopped with " + calls.size() + " pending request(s)"));
+          return false;
+        }
 
-      if (!calls.isEmpty()) {
-        // shouldCloseConnection can be set to true by a parallel thread here. The caller
-        //  will need to check anyway.
-        return true;
-      }
+        if (!calls.isEmpty()) {
+          // shouldCloseConnection can be set to true by a parallel thread here. The caller
+          //  will need to check anyway.
+          return true;
+        }
 
-      if (EnvironmentEdgeManager.currentTimeMillis() >= waitUntil) {
-        // Connection is idle.
-        // We expect the number of calls to be zero here, but actually someone can
-        //  adds a call at the any moment, as there is no synchronization between this task
-        //  and adding new calls. It's not a big issue, but it will get an exception.
-        markClosed(new IOException(
-            "idle connection closed with " + calls.size() + " pending request(s)"));
-        return false;
-      }
+        if (EnvironmentEdgeManager.currentTimeMillis() >= waitUntil) {
+          // Connection is idle.
+          // We expect the number of calls to be zero here, but actually someone can
+          //  adds a call at the any moment, as there is no synchronization between this
task
+          //  and adding new calls. It's not a big issue, but it will get an exception.
+          markClosed(new IOException(
+              "idle connection closed with " + calls.size() + " pending request(s)"));
+          return false;
+        }
 
-      // We can get here if we received a notification that there is some work to do but
-      //  the work was cancelled. As we're not idle we continue to wait.
-      return false;
+        wait(Math.min(minIdleTimeBeforeClose, 1000));
+      }
     }
 
     public InetSocketAddress getRemoteAddress() {


Mime
View raw message