THRIFT-766. java: Propagate TSocket timeout to connect
authorBryan Duxbury <bryanduxbury@apache.org>
Thu, 29 Apr 2010 17:08:17 +0000 (17:08 +0000)
committerBryan Duxbury <bryanduxbury@apache.org>
Thu, 29 Apr 2010 17:08:17 +0000 (17:08 +0000)
This patch makes sure the specified timeout is used when opening connections, too.

Patch: David Helder

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@939380 13f79535-47bb-0310-9956-ffa450edef68

lib/java/src/org/apache/thrift/transport/TSocket.java

index 75ceddc..606e8a9 100644 (file)
@@ -177,7 +177,7 @@ public class TSocket extends TIOStreamTransport {
     }
 
     try {
-      socket_.connect(new InetSocketAddress(host_, port_));
+      socket_.connect(new InetSocketAddress(host_, port_), timeout_);
       inputStream_ = new BufferedInputStream(socket_.getInputStream(), 1024);
       outputStream_ = new BufferedOutputStream(socket_.getOutputStream(), 1024);
     } catch (IOException iox) {