hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1496216 - /hbase/branches/0.94/security/src/main/java/org/apache/hadoop/hbase/ipc/SecureClient.java
Date Mon, 24 Jun 2013 20:52:05 GMT
Author: larsh
Date: Mon Jun 24 20:52:05 2013
New Revision: 1496216

URL: http://svn.apache.org/r1496216
Log:
HBASE-8656 Rpc call may not be notified in SecureClient (cuijianwei)

Modified:
    hbase/branches/0.94/security/src/main/java/org/apache/hadoop/hbase/ipc/SecureClient.java

Modified: hbase/branches/0.94/security/src/main/java/org/apache/hadoop/hbase/ipc/SecureClient.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/security/src/main/java/org/apache/hadoop/hbase/ipc/SecureClient.java?rev=1496216&r1=1496215&r2=1496216&view=diff
==============================================================================
--- hbase/branches/0.94/security/src/main/java/org/apache/hadoop/hbase/ipc/SecureClient.java
(original)
+++ hbase/branches/0.94/security/src/main/java/org/apache/hadoop/hbase/ipc/SecureClient.java
Mon Jun 24 20:52:05 2013
@@ -367,7 +367,11 @@ public class SecureClient extends HBaseC
         if (LOG.isDebugEnabled())
           LOG.debug(getName() + " got value #" + id);
 
-        Call call = calls.remove(id);
+        // we first get the call by id, then remove it from call map after processed.
+        // If we remove the call here, thread waiting on the call can not be notified
+        // if any we encounter any exception in the 'try' block. Refer to 'receiveResponse'
+        // in org.apache.hadoop.hbase.ipc.HBaseClient.java
+        Call call = calls.get(id);
 
         int state = in.readInt();     // read call status
         if (LOG.isDebugEnabled()) {
@@ -390,10 +394,17 @@ public class SecureClient extends HBaseC
                 .readString(in)));
           }
         } else if (state == Status.FATAL.state) {
+          RemoteException exception = new RemoteException(WritableUtils.readString(in),
+              WritableUtils.readString(in));
+          // the call will be removed from call map, we must set Exception here to notify
+          // the thread waited on the call
+          if (call != null) {
+            call.setException(exception);
+          }
           // Close the connection
-          markClosed(new RemoteException(WritableUtils.readString(in),
-                                         WritableUtils.readString(in)));
+          markClosed(exception);
         }
+        calls.remove(id);
       } catch (IOException e) {
         if (e instanceof SocketTimeoutException && remoteId.rpcTimeout > 0) {
           // Clean up open calls but don't treat this as a fatal condition,



Mime
View raw message