thrift-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bryanduxb...@apache.org
Subject svn commit: r901513 - /incubator/thrift/trunk/lib/java/src/org/apache/thrift/transport/TNonblockingServerSocket.java
Date Thu, 21 Jan 2010 03:20:10 GMT
Author: bryanduxbury
Date: Thu Jan 21 03:20:01 2010
New Revision: 901513

URL: http://svn.apache.org/viewvc?rev=901513&view=rev
Log:
THRIFT-684. java: Add constructor to TNonblockingServerSocket to accept InetSocketAddress

Modified:
    incubator/thrift/trunk/lib/java/src/org/apache/thrift/transport/TNonblockingServerSocket.java

Modified: incubator/thrift/trunk/lib/java/src/org/apache/thrift/transport/TNonblockingServerSocket.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/src/org/apache/thrift/transport/TNonblockingServerSocket.java?rev=901513&r1=901512&r2=901513&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/src/org/apache/thrift/transport/TNonblockingServerSocket.java
(original)
+++ incubator/thrift/trunk/lib/java/src/org/apache/thrift/transport/TNonblockingServerSocket.java
Thu Jan 21 03:20:01 2010
@@ -81,7 +81,15 @@
    * Creates just a port listening server socket
    */
   public TNonblockingServerSocket(int port, int clientTimeout) throws TTransportException
{
+    this(new InetSocketAddress(port), clientTimeout);
     port_ = port;
+  }  
+
+  public TNonblockingServerSocket(InetSocketAddress bindAddr) throws TTransportException
{
+    this(bindAddr, 0);
+  }
+
+  public TNonblockingServerSocket(InetSocketAddress bindAddr, int clientTimeout) throws TTransportException
{
     clientTimeout_ = clientTimeout;
     try {
       serverSocketChannel = ServerSocketChannel.open();
@@ -92,10 +100,10 @@
       // Prevent 2MSL delay problem on server restarts
       serverSocket_.setReuseAddress(true);
       // Bind to listening port
-      serverSocket_.bind(new InetSocketAddress(port_));
+      serverSocket_.bind(bindAddr);
     } catch (IOException ioe) {
       serverSocket_ = null;
-      throw new TTransportException("Could not create ServerSocket on port " + port + ".");
+      throw new TTransportException("Could not create ServerSocket on address " + bindAddr.toString()
+ ".");
     }
   }
 



Mime
View raw message