hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r1061597 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
Date Fri, 21 Jan 2011 02:10:34 GMT
Author: apurtell
Date: Fri Jan 21 02:10:34 2011
New Revision: 1061597

URL: http://svn.apache.org/viewvc?rev=1061597&view=rev
Log:
HBASE-3456 Fix hardcoding of 20 second socket timeout down in HBaseClient

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1061597&r1=1061596&r2=1061597&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Fri Jan 21 02:10:34 2011
@@ -1,9 +1,10 @@
 HBase Change Log
 Release 0.90.1 - Unreleased
   BUG FIXES
-   HBASE-3387 Revert 'Pair does not deep check arrays for equality'
-   HBASE-3445 Master crashes on data that was moved from different host
-   HBASE-3449 Server shutdown handlers deadlocked waiting for META
+   HBASE-3387  Revert 'Pair does not deep check arrays for equality'
+   HBASE-3445  Master crashes on data that was moved from different host
+   HBASE-3449  Server shutdown handlers deadlocked waiting for META
+   HBASE-3456  Fix hardcoding of 20 second socket timeout down in HBaseClient
 
   IMPROVEMENTS
 

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java?rev=1061597&r1=1061596&r2=1061597&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java Fri Jan
21 02:10:34 2011
@@ -80,12 +80,15 @@ 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
+  protected int socketTimeout; // socket timeout
 
   protected final SocketFactory socketFactory;           // how to create sockets
   private int refCount = 1;
 
   final private static String PING_INTERVAL_NAME = "ipc.ping.interval";
-  final static int DEFAULT_PING_INTERVAL = 60000; // 1 min
+  final private static String SOCKET_TIMEOUT = "ipc.socket.timeout";
+  final static int DEFAULT_PING_INTERVAL = 60000;  // 1 min
+  final static int DEFAULT_SOCKET_TIMEOUT = 20000; // 20 seconds
   final static int PING_CALL_ID = -1;
 
   /**
@@ -94,7 +97,6 @@ public class HBaseClient {
    * @param conf Configuration
    * @param pingInterval the ping interval
    */
-  @SuppressWarnings({"UnusedDeclaration"})
   public static void setPingInterval(Configuration conf, int pingInterval) {
     conf.setInt(PING_INTERVAL_NAME, pingInterval);
   }
@@ -111,6 +113,22 @@ public class HBaseClient {
   }
 
   /**
+   * Set the socket timeout
+   * @param conf Configuration
+   * @param socketTimeout the socket timeout
+   */
+  public static void setSocketTimeout(Configuration conf, int socketTimeout) {
+    conf.setInt(SOCKET_TIMEOUT, socketTimeout);
+  }
+
+  /**
+   * @return the socket timeout
+   */
+  static int getSocketTimeout(Configuration conf) {
+    return conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
+  }
+
+  /**
    * Increment this client's reference count
    *
    */
@@ -307,8 +325,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(),
+              getSocketTimeout(conf));
             if (remoteId.rpcTimeout > 0) {
               pingInterval = remoteId.rpcTimeout; // overwrite pingInterval
             }



Mime
View raw message