}
_isShuttingDown = false;
ConnectionAcceptor acceptor = null;
ChannelRegistrar processors[] = new ChannelRegistrar[this._serverInfo.getTargetedConnectionProcessors()];
ServerSocketChannel channel = null;
try
{
channel = ServerSocketChannel.open();
channel.configureBlocking( false );
channel.socket().setReuseAddress( true );
InetSocketAddress address = new InetSocketAddress( _serverInfo.getInterface(), _serverInfo.getPort() );
channel.socket().bind( address, 1024 );
this._serverInfo.setHost( address.getHostName() + ':' + address.getPort() );
// this._connectionHeader.setChannel(channel);
for ( int i = 0; i < processors.length; i++ )
{
processors[i] = new CombinedConnectionProcessor( this._serverInfo );
((Thread) processors[i]).setDaemon( true );
}
acceptor = new ConnectionAcceptor( channel, processors );
//acceptor.setDaemon( true );
}
catch ( IOException e )
{
logger.log( Level.SEVERE, "!!! IOException occured !!! ", e );
IOUtil.closeQuiet( channel );
throw (e);
}
for ( int i = 0; i < processors.length; i++ )
{
((CombinedConnectionProcessor) processors[i]).start();
}
acceptor.start();
this._serverInfo.setServerRunning( true );
this._processors = processors;
this._acceptor = acceptor;
this._channel = channel;
EJServerRegistry.getInstance().register( this );
if ( logger.isLoggable( Level.INFO ) )
{
logger.log( Level.INFO, "EJOE server listening on: " + channel.socket().getLocalSocketAddress() );
logger.log( Level.INFO, "Using " + processors.length + " Connection Processor"
+ (processors.length > 1 ? "s" : "") );
logger.log( Level.INFO, "Using non-blocking IO: " + this._serverInfo.hasNonBlockingReadWrite() );
logger.log( Level.INFO, "Allowing persistent client connections: " + this._serverInfo.isPersistent() );
logger.log( Level.INFO, "Using compression: " + this._serverInfo.hasCompression() );