فهرست منبع

HADOOP-642. Change IPC client to specify an explicit connect timeout. Contributed by Konstantin.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@468117 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 سال پیش
والد
کامیت
7af6868738
3فایلهای تغییر یافته به همراه9 افزوده شده و 7 حذف شده
  1. 3 0
      CHANGES.txt
  2. 3 4
      src/java/org/apache/hadoop/ipc/Client.java
  3. 3 3
      src/java/org/apache/hadoop/ipc/Server.java

+ 3 - 0
CHANGES.txt

@@ -66,6 +66,9 @@ Trunk (unreleased changes)
     a re-discovered DataNode, so that no-longer-needed replications
     are stopped promptly.  (Konstantin Shvachko via cutting)
 
+18. HADOOP-642.  Change IPC client to specify an explicit connect
+    timeout.  (Konstantin Shvachko via cutting)
+
 
 Release 0.7.2 - 2006-10-18
 

+ 3 - 4
src/java/org/apache/hadoop/ipc/Client.java

@@ -32,16 +32,14 @@ import java.io.FilterOutputStream;
 
 import java.util.Hashtable;
 import java.util.Iterator;
-import java.util.Collection;
-import java.util.Random;
 
 import org.apache.commons.logging.*;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configurable;
+import org.apache.hadoop.dfs.FSConstants;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableUtils;
-import org.apache.hadoop.io.UTF8;
 import org.apache.hadoop.io.DataOutputBuffer;
 
 /** A client for an IPC service.  IPC calls take a single {@link Writable} as a
@@ -134,7 +132,8 @@ public class Client {
       short failures = 0;
       while (true) {
         try {
-          this.socket = new Socket(address.getAddress(), address.getPort());
+          this.socket = new Socket();
+          this.socket.connect(address, FSConstants.READ_TIMEOUT);
           break;
         } catch (IOException ie) { //SocketTimeoutException is also caught 
           if (failures == maxRetries) {

+ 3 - 3
src/java/org/apache/hadoop/ipc/Server.java

@@ -295,9 +295,9 @@ public abstract class Server {
         numConnections++;
       }
       if (LOG.isDebugEnabled())
-        LOG.debug("Server connection on port " + port + " from " + 
-                c.getHostAddress() +
-                ": starting. Number of active connections: " + numConnections);
+        LOG.debug("Server connection from " + c.toString() +
+                "; # active connections: " + numConnections +
+                "; # queued calls: " + callQueue.size() );
     }
 
     void doRead(SelectionKey key) {