return;
}
int endPort = maxPort;
if (endPort < startPort)
endPort = startPort;
ServerSocketChannel ssc = ServerSocketChannel.open();
ssc.configureBlocking(false);
for( int i=startPort; i<=endPort; i++ ) {
try {
InetSocketAddress iddr = null;
if( inet == null ) {
iddr = new InetSocketAddress( i);
} else {
iddr=new InetSocketAddress( inet, i);
}
sSocket = ssc.socket();
sSocket.bind(iddr);
port=i;
break;
} catch( IOException ex ) {
if(log.isInfoEnabled())
log.info("Port busy " + i + " " + ex.toString());
sSocket = null;
}
}
if( sSocket==null ) {
log.error("Can't find free port " + startPort + " " + endPort );
return;
}
if(log.isInfoEnabled())
log.info("JK: ajp13 listening on " + getAddress() + ":" + port );
selector = Selector.open();
ssc.register(selector, SelectionKey.OP_ACCEPT);
// 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( "channelNioSocket".equals( name ) &&
port != startPort &&
(wEnv.getLocalId()==0) ) {