|
|
@ -318,7 +318,13 @@ public class SelectorKernel extends AbstractKernel |
|
|
|
|
|
|
|
|
|
|
|
protected void cancel( NioEndpoint p ) throws IOException |
|
|
|
protected void cancel( NioEndpoint p ) throws IOException |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
log.log( Level.INFO, "Closing endpoint:{0}.", p ); |
|
|
|
SelectionKey key = endpointKeys.remove(p); |
|
|
|
SelectionKey key = endpointKeys.remove(p); |
|
|
|
|
|
|
|
if( key == null ) { |
|
|
|
|
|
|
|
log.log( Level.INFO, "Endpoint already closed:{0}.", p ); |
|
|
|
|
|
|
|
return; // already closed it
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SocketChannel c = (SocketChannel)key.channel(); |
|
|
|
SocketChannel c = (SocketChannel)key.channel(); |
|
|
|
|
|
|
|
|
|
|
|
// Note: key.cancel() is specifically thread safe. One of
|
|
|
|
// Note: key.cancel() is specifically thread safe. One of
|
|
|
@ -332,6 +338,7 @@ public class SelectorKernel extends AbstractKernel |
|
|
|
protected void cancel( SelectionKey key, SocketChannel c ) throws IOException |
|
|
|
protected void cancel( SelectionKey key, SocketChannel c ) throws IOException |
|
|
|
{ |
|
|
|
{ |
|
|
|
NioEndpoint p = (NioEndpoint)key.attachment(); |
|
|
|
NioEndpoint p = (NioEndpoint)key.attachment(); |
|
|
|
|
|
|
|
log.log( Level.INFO, "Closing channel endpoint:{0}.", p ); |
|
|
|
endpointKeys.remove(p); |
|
|
|
endpointKeys.remove(p); |
|
|
|
|
|
|
|
|
|
|
|
key.cancel(); |
|
|
|
key.cancel(); |
|
|
|