You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by nk...@apache.org on 2012/08/22 18:48:12 UTC

svn commit: r1376136 - /hbase/branches/0.94/security/src/main/java/org/apache/hadoop/hbase/ipc/SecureClient.java

Author: nkeywal
Date: Wed Aug 22 16:48:12 2012
New Revision: 1376136

URL: http://svn.apache.org/viewvc?rev=1376136&view=rev
Log:
HBASE-6364 Powering down the server host holding the .META. table causes HBase Client to take excessively long to recover and connect to reassigned .META. table - security addendum

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=1376136&r1=1376135&r2=1376136&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 Wed Aug 22 16:48:12 2012
@@ -468,38 +468,12 @@ public class SecureClient extends HBaseC
     this(valueClass, conf, NetUtils.getDefaultSocketFactory(conf));
   }
 
+  /**
+   * Creates a SecureConnection. Can be overridden by a subclass for testing.
+   * @param remoteId - the ConnectionId to use for the connection creation.
+   */
   @Override
-  protected SecureConnection getConnection(InetSocketAddress addr,
-                                   Class<? extends VersionedProtocol> protocol,
-                                   User ticket,
-                                   int rpcTimeout,
-                                   Call call)
-                                   throws IOException, InterruptedException {
-    if (!running.get()) {
-      // the client is stopped
-      throw new IOException("The client is stopped");
-    }
-    SecureConnection connection;
-    /* we could avoid this allocation for each RPC by having a
-     * connectionsId object and with set() method. We need to manage the
-     * refs for keys in HashMap properly. For now its ok.
-     */
-    ConnectionId remoteId = new ConnectionId(addr, protocol, ticket, rpcTimeout);
-    do {
-      synchronized (connections) {
-        connection = (SecureConnection)connections.get(remoteId);
-        if (connection == null) {
-          connection = new SecureConnection(remoteId);
-          connections.put(remoteId, connection);
-        }
-      }
-    } while (!connection.addCall(call));
-
-    //we don't invoke the method below inside "synchronized (connections)"
-    //block above. The reason for that is if the server happens to be slow,
-    //it will take longer to establish a connection and that will slow the
-    //entire system down.
-    connection.setupIOstreams();
-    return connection;
+  protected SecureConnection createConnection(ConnectionId remoteId) throws IOException {
+    return new SecureConnection(remoteId);
   }
-}
\ No newline at end of file
+}