if( 0 == socket.getSoTimeout() )
{
socket.setSoTimeout( m_soTimeout );
}
final ConnectionAcceptor acceptor;
synchronized( m_acceptors )
{
if( isConnected( name ) )
{
final String message =
"Connection already exists with name " + name;
throw new IllegalArgumentException( message );
}
final AcceptorConfig config = new AcceptorConfig( name, socket, handler );
acceptor = new ConnectionAcceptor( config, getMonitor() );
m_acceptors.put( name, acceptor );
}
final Thread thread =
new Thread( acceptor, "Acceptor[" + name + "]" );
thread.start();
while( !acceptor.hasStarted() )
{
Thread.sleep( 5 );
}
}