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: [email protected]
For additional commands, e-mail: [email protected]