svn commit: r1795352 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1795352 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Mark Thomas-2
Author: markt
Date: Tue May 16 18:23:12 2017
New Revision: 1795352

URL: http://svn.apache.org/viewvc?rev=1795352&view=rev
Log:
Refactor to make it easier for folks who are extending Nio with custom sockets

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1795352&r1=1795351&r2=1795352&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Tue May 16 18:23:12 2017
@@ -199,12 +199,7 @@ public class NioEndpoint extends Abstrac
      */
     @Override
     public void bind() throws Exception {
-
-        serverSock = ServerSocketChannel.open();
-        socketProperties.setProperties(serverSock.socket());
-        InetSocketAddress addr = (getAddress()!=null?new InetSocketAddress(getAddress(),getPort()):new InetSocketAddress(getPort()));
-        serverSock.socket().bind(addr,getAcceptCount());
-        serverSock.configureBlocking(true); //mimic APR behavior
+        initServerSocket();
 
         // Initialize thread count defaults for acceptor, poller
         if (acceptorThreadCount == 0) {
@@ -223,6 +218,17 @@ public class NioEndpoint extends Abstrac
         selectorPool.open();
     }
 
+    // Separated out to make it easier for folks that extend NioEndpoint to
+    // implement custom [server]sockets
+    protected void initServerSocket() throws Exception {
+        serverSock = ServerSocketChannel.open();
+        socketProperties.setProperties(serverSock.socket());
+        InetSocketAddress addr = (getAddress()!=null?new InetSocketAddress(getAddress(),getPort()):new InetSocketAddress(getPort()));
+        serverSock.socket().bind(addr,getAcceptCount());
+        serverSock.configureBlocking(true); //mimic APR behavior
+    }
+
+
     /**
      * Start the NIO endpoint, creating acceptor, poller threads.
      */



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]