Allow to obtain the Worker that was used to serve the IO of a Channel

This commit is contained in:
Norman Maurer 2012-03-06 19:26:32 +01:00
parent e0e87ce2bc
commit bc47850bbe
3 changed files with 20 additions and 0 deletions

View File

@ -115,6 +115,16 @@ abstract class AbstractNioChannel<C extends SelectableChannel & WritableByteChan
this.channel = ch;
}
/**
* Return the {@link AbstractNioWorker} that handle the IO of the {@link AbstractNioChannel}
*
* @return worker
*/
public AbstractNioWorker getWorker() {
return worker;
}
@Override
public InetSocketAddress getLocalAddress() {
InetSocketAddress localAddress = this.localAddress;

View File

@ -66,6 +66,11 @@ final class NioDatagramChannel extends AbstractNioChannel<DatagramChannel>
}
@Override
public NioDatagramWorker getWorker() {
return (NioDatagramWorker) super.getWorker();
}
@Override
public boolean isBound() {
return isOpen() && channel.socket().isBound();

View File

@ -43,6 +43,11 @@ class NioSocketChannel extends AbstractNioChannel<SocketChannel>
config = new DefaultNioSocketChannelConfig(socket.socket());
}
@Override
public NioWorker getWorker() {
return (NioWorker) super.getWorker();
}
@Override
public NioSocketChannelConfig getConfig() {
return config;