hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-14431 AsyncRpcClient#removeConnection() never removes connection from connections pool if server fails (Samir Ahmic)
Date Sat, 19 Sep 2015 14:34:09 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 936693b92 -> 388e948df


HBASE-14431 AsyncRpcClient#removeConnection() never removes connection from connections pool
if server fails (Samir Ahmic)


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

Branch: refs/heads/branch-1.2
Commit: 388e948dfedab59cfe8fe8cf42001fec0eb32cd3
Parents: 936693b
Author: tedyu <yuzhihong@gmail.com>
Authored: Sat Sep 19 07:34:06 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Sat Sep 19 07:34:06 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/ipc/AsyncRpcChannel.java | 15 +++++++++++++++
 .../org/apache/hadoop/hbase/ipc/AsyncRpcClient.java  |  4 ++--
 2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/388e948d/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.java
index dbc39cf..43d75f9 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.java
@@ -712,6 +712,21 @@ public class AsyncRpcChannel {
   public int getConnectionHashCode() {
     return ConnectionId.hashCode(ticket, serviceName, address);
   }
+  
+  @Override
+  public int hashCode() {
+    return getConnectionHashCode();
+  }
+     
+  @Override
+  public boolean equals(Object obj) {
+    if (obj instanceof AsyncRpcChannel) {
+      AsyncRpcChannel channel = (AsyncRpcChannel) obj;
+      return channel.hashCode() == obj.hashCode();
+    }
+    return false;
+  }
+
 
   @Override
   public String toString() {

http://git-wip-us.apache.org/repos/asf/hbase/blob/388e948d/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java
index a84cc1a..876eb70 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcClient.java
@@ -398,12 +398,12 @@ public class AsyncRpcClient extends AbstractRpcClient {
    * Remove connection from pool
    */
   public void removeConnection(AsyncRpcChannel connection) {
-    int connectionHashCode = connection.getConnectionHashCode();
+    int connectionHashCode = connection.hashCode();
     synchronized (connections) {
       // we use address as cache key, so we should check here to prevent removing the
       // wrong connection
       AsyncRpcChannel connectionInPool = this.connections.get(connectionHashCode);
-      if (connectionInPool == connection) {
+      if (connectionInPool.equals(connection)) {
         this.connections.remove(connectionHashCode);
       } else if (LOG.isDebugEnabled()) {
         LOG.debug(String.format("%s already removed, expected instance %08x, actual %08x",


Mime
View raw message