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:35:20 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.1 05618091b -> 911c4342a


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/911c4342
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/911c4342
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/911c4342

Branch: refs/heads/branch-1.1
Commit: 911c4342ae66447d51ec05e25eeb3b6c4d348a22
Parents: 0561809
Author: tedyu <yuzhihong@gmail.com>
Authored: Sat Sep 19 07:35:17 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Sat Sep 19 07:35:17 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/911c4342/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 29554ad..5906708 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/911c4342/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 5162675..80156d6 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
@@ -393,12 +393,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