hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkey...@apache.org
Subject svn commit: r1376136 - /hbase/branches/0.94/security/src/main/java/org/apache/hadoop/hbase/ipc/SecureClient.java
Date Wed, 22 Aug 2012 16:48:12 GMT
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
+}



Mime
View raw message