Package org.jboss.netty.channel
Class DefaultChannelPipeline.DefaultChannelHandlerContext
- java.lang.Object
-
- org.jboss.netty.channel.DefaultChannelPipeline.DefaultChannelHandlerContext
-
- All Implemented Interfaces:
ChannelHandlerContext
- Enclosing class:
- DefaultChannelPipeline
private final class DefaultChannelPipeline.DefaultChannelHandlerContext extends java.lang.Object implements ChannelHandlerContext
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
attachment
private boolean
canHandleDownstream
private boolean
canHandleUpstream
private ChannelHandler
handler
private java.lang.String
name
(package private) DefaultChannelPipeline.DefaultChannelHandlerContext
next
(package private) DefaultChannelPipeline.DefaultChannelHandlerContext
prev
-
Constructor Summary
Constructors Constructor Description DefaultChannelHandlerContext(DefaultChannelPipeline.DefaultChannelHandlerContext prev, DefaultChannelPipeline.DefaultChannelHandlerContext next, java.lang.String name, ChannelHandler handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHandleDownstream()
boolean
canHandleUpstream()
java.lang.Object
getAttachment()
Retrieves an object which isattached
to this context.Channel
getChannel()
Returns theChannel
that theChannelPipeline
belongs to.ChannelHandler
getHandler()
Returns theChannelHandler
that this context object is serving.java.lang.String
getName()
Returns the name of theChannelHandler
in theChannelPipeline
.ChannelPipeline
getPipeline()
Returns theChannelPipeline
that theChannelHandler
belongs to.void
sendDownstream(ChannelEvent e)
Sends the specifiedChannelEvent
to theChannelDownstreamHandler
which is placed in the closest downstream from the handler associated with this context.void
sendUpstream(ChannelEvent e)
Sends the specifiedChannelEvent
to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with this context.void
setAttachment(java.lang.Object attachment)
Attaches an object to this context to store a stateful information specific to theChannelHandler
which is associated with this context.
-
-
-
Field Detail
-
next
volatile DefaultChannelPipeline.DefaultChannelHandlerContext next
-
prev
volatile DefaultChannelPipeline.DefaultChannelHandlerContext prev
-
name
private final java.lang.String name
-
handler
private final ChannelHandler handler
-
canHandleUpstream
private final boolean canHandleUpstream
-
canHandleDownstream
private final boolean canHandleDownstream
-
attachment
private volatile java.lang.Object attachment
-
-
Constructor Detail
-
DefaultChannelHandlerContext
DefaultChannelHandlerContext(DefaultChannelPipeline.DefaultChannelHandlerContext prev, DefaultChannelPipeline.DefaultChannelHandlerContext next, java.lang.String name, ChannelHandler handler)
-
-
Method Detail
-
getChannel
public Channel getChannel()
Description copied from interface:ChannelHandlerContext
Returns theChannel
that theChannelPipeline
belongs to. This method is a shortcut to getPipeline().getChannel().- Specified by:
getChannel
in interfaceChannelHandlerContext
-
getPipeline
public ChannelPipeline getPipeline()
Description copied from interface:ChannelHandlerContext
Returns theChannelPipeline
that theChannelHandler
belongs to.- Specified by:
getPipeline
in interfaceChannelHandlerContext
-
canHandleDownstream
public boolean canHandleDownstream()
Description copied from interface:ChannelHandlerContext
- Specified by:
canHandleDownstream
in interfaceChannelHandlerContext
-
canHandleUpstream
public boolean canHandleUpstream()
Description copied from interface:ChannelHandlerContext
- Specified by:
canHandleUpstream
in interfaceChannelHandlerContext
-
getHandler
public ChannelHandler getHandler()
Description copied from interface:ChannelHandlerContext
Returns theChannelHandler
that this context object is serving.- Specified by:
getHandler
in interfaceChannelHandlerContext
-
getName
public java.lang.String getName()
Description copied from interface:ChannelHandlerContext
Returns the name of theChannelHandler
in theChannelPipeline
.- Specified by:
getName
in interfaceChannelHandlerContext
-
getAttachment
public java.lang.Object getAttachment()
Description copied from interface:ChannelHandlerContext
Retrieves an object which isattached
to this context.- Specified by:
getAttachment
in interfaceChannelHandlerContext
- Returns:
null
if no object was attached ornull
was attached
-
setAttachment
public void setAttachment(java.lang.Object attachment)
Description copied from interface:ChannelHandlerContext
Attaches an object to this context to store a stateful information specific to theChannelHandler
which is associated with this context.- Specified by:
setAttachment
in interfaceChannelHandlerContext
-
sendDownstream
public void sendDownstream(ChannelEvent e)
Description copied from interface:ChannelHandlerContext
Sends the specifiedChannelEvent
to theChannelDownstreamHandler
which is placed in the closest downstream from the handler associated with this context. It is recommended to use the shortcut methods inChannels
rather than calling this method directly.- Specified by:
sendDownstream
in interfaceChannelHandlerContext
-
sendUpstream
public void sendUpstream(ChannelEvent e)
Description copied from interface:ChannelHandlerContext
Sends the specifiedChannelEvent
to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with this context. It is recommended to use the shortcut methods inChannels
rather than calling this method directly.- Specified by:
sendUpstream
in interfaceChannelHandlerContext
-
-