Added ChannelHandlerContext.getChannel()

This commit is contained in:
Trustin Lee 2008-12-03 08:31:17 +00:00
parent e659482215
commit cd3c0d25c8
2 changed files with 10 additions and 0 deletions

View File

@ -44,6 +44,12 @@ package org.jboss.netty.channel;
*/
public interface ChannelHandlerContext {
/**
* Returns the {@link Channel} that the {@link ChannelPipeline} belongs to.
* This method is a shortcut to <tt>getPipeline().getChannel()</tt>.
*/
Channel getChannel();
/**
* Returns the {@link ChannelPipeline} that the {@link ChannelHandler}
* belongs to.

View File

@ -761,6 +761,10 @@ public class DefaultChannelPipeline implements ChannelPipeline {
this.handler = handler;
}
public Channel getChannel() {
return getPipeline().getChannel();
}
public ChannelPipeline getPipeline() {
return DefaultChannelPipeline.this;
}