mturk 2002/11/22 09:46:33 Modified: jk/java/org/apache/jk/common ChannelSocket.java Log: 1. Setting port to 0 will disble the channel socket. This is usefull for JNI where there is no need for channelSocket. Less wasted resources... 2. Allow address="x.x.x.x" in the server.xml. This wil bind the specified IP address in case one have few on the box. Revision Changes Path 1.28 +32 -21 jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelSocket.java Index: ChannelSocket.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelSocket.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- ChannelSocket.java 21 Nov 2002 09:32:17 -0000 1.27 +++ ChannelSocket.java 22 Nov 2002 17:46:33 -0000 1.28 @@ -303,27 +303,35 @@ /** * @jmx:managed-operation */ - public void init() throws IOException { - // Find a port. - if( maxPort<startPort) maxPort=startPort; - - for( int i=startPort; i<=maxPort; i++ ) { - try { - sSocket=new ServerSocket( i ); - port=i; - break; - } catch( IOException ex ) { - log.info("Port busy " + i + " " + ex.toString()); - continue; - } - } - - if( sSocket==null ) { - log.error("Can't find free port " + startPort + " " + maxPort ); - return; - } - log.info("JK2: ajp13 listening on tcp port " + port ); - + public void init() throws IOException { + // Find a port. + if (startPort == 0) { + port = 0; + log.info("JK2: ajp13 disabling channelSocket"); + running = true; + return; + } + if (maxPort < startPort) + maxPort = startPort; + if (getAddress() == null) + setAddress("localhost"); + for( int i=startPort; i<=maxPort; i++ ) { + try { + sSocket=new ServerSocket( i, 0, inet ); + port=i; + break; + } catch( IOException ex ) { + log.info("Port busy " + i + " " + ex.toString()); + continue; + } + } + + if( sSocket==null ) { + log.error("Can't find free port " + startPort + " " + maxPort ); + return; + } + log.info("JK2: ajp13 listening on " + getAddress() + ":" + port ); + // If this is not the base port and we are the 'main' channleSocket and // SHM didn't already set the localId - we'll set the instance id if( "channelSocket".equals( name ) && @@ -363,6 +371,9 @@ public void destroy() throws IOException { running = false; try { + /* If we disabled the channel return */ + if (port == 0) + return; tp.shutdown(); // Need to create a connection to unlock the accept();
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>