accept_selector.register(
channel,
new VirtualChannelSelector.VirtualAcceptSelectorListener()
{
public boolean
selectSuccess(
VirtualChannelSelector selector,
ServerSocketChannel sc,
Object attachment)
{
try{
SocketChannel new_channel = sc.accept();
if ( new_channel == null ){
return( false );
}
new_channel.configureBlocking( false );
listener.newConnectionAccepted( new_channel );
return( true );
}catch( IOException e ){
Debug.printStackTrace(e);
return( true );
}
}
public void
selectFailure(
VirtualChannelSelector selector,
ServerSocketChannel sc,
Object attachment,
Throwable msg )
{
Debug.printStackTrace(msg);
}
},
null );