hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nspiegelb...@apache.org
Subject svn commit: r1181522 - /hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
Date Tue, 11 Oct 2011 02:16:29 GMT
Author: nspiegelberg
Date: Tue Oct 11 02:16:29 2011
New Revision: 1181522

URL: http://svn.apache.org/viewvc?rev=1181522&view=rev
Log:
Make the client connection timeout configurable

Summary:
Make the client connection timeout configurable
set the default to 5 sec

Test Plan:
test locally

Reviewed By: dhruba
Reviewers: kannan, nspiegelberg
Commenters: kannan
CC: hbase@lists, , kannan, liyintang
Differential Revision: 235630

Modified:
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java?rev=1181522&r1=1181521&r2=1181522&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java Tue Oct
11 02:16:29 2011
@@ -79,6 +79,7 @@ public class HBaseClient {
   protected final boolean tcpNoDelay; // if T then disable Nagle's Algorithm
   protected final boolean tcpKeepAlive; // if T then use keepalives
   protected int pingInterval; // how often sends ping to the server in msecs
+  private final int connectionTimeOutMillSec; // the connection time out
 
   protected final SocketFactory socketFactory;           // how to create sockets
   private int refCount = 1;
@@ -306,8 +307,8 @@ public class HBaseClient {
             this.socket = socketFactory.createSocket();
             this.socket.setTcpNoDelay(tcpNoDelay);
             this.socket.setKeepAlive(tcpKeepAlive);
-            // connection time out is 20s
-            NetUtils.connect(this.socket, remoteId.getAddress(), 20000);
+            NetUtils.connect(this.socket, remoteId.getAddress(),
+			connectionTimeOutMillSec);
             if (remoteId.rpcTimeout > 0) {
               pingInterval = remoteId.rpcTimeout; // overwrite pingInterval
             }
@@ -663,6 +664,8 @@ public class HBaseClient {
     }
     this.conf = conf;
     this.socketFactory = factory;
+    this.connectionTimeOutMillSec =
+	conf.getInt("hbase.client.connection.timeout.millsec", 5000);
   }
 
   /**



Mime
View raw message