Added ChannelHandlerContext.get/setAttachment() - NETTY-134
This commit is contained in:
parent
f4dd29c70f
commit
d2c4a1143e
@ -95,4 +95,7 @@ public interface ChannelHandlerContext {
|
||||
* rather than calling this method directly.
|
||||
*/
|
||||
void sendDownstream(ChannelEvent e);
|
||||
|
||||
Object getAttachment();
|
||||
void setAttachment(Object attachment);
|
||||
}
|
@ -694,6 +694,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
|
||||
private final ChannelHandler handler;
|
||||
private final boolean canHandleUpstream;
|
||||
private final boolean canHandleDownstream;
|
||||
private volatile Object attachment;
|
||||
|
||||
DefaultChannelHandlerContext(
|
||||
DefaultChannelHandlerContext prev, DefaultChannelHandlerContext next,
|
||||
@ -774,6 +775,14 @@ public class DefaultChannelPipeline implements ChannelPipeline {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Object getAttachment() {
|
||||
return attachment;
|
||||
}
|
||||
|
||||
public void setAttachment(Object attachment) {
|
||||
this.attachment = attachment;
|
||||
}
|
||||
|
||||
public void sendDownstream(ChannelEvent e) {
|
||||
DefaultChannelHandlerContext prev = getActualDownstreamContext(this.prev);
|
||||
if (prev == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user