Class DefaultChannelPipeline
java.lang.Object
org.jboss.netty.channel.DefaultChannelPipeline
- All Implemented Interfaces:
ChannelPipeline
- Direct Known Subclasses:
AbstractCodecEmbedder.EmbeddedChannelPipeline
The default
ChannelPipeline implementation. It is recommended
to use Channels.pipeline() to create a new ChannelPipeline
instance rather than calling the constructor directly.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Channel(package private) static final ChannelSink(package private) static final InternalLoggerprivate final Map<String, DefaultChannelPipeline.DefaultChannelHandlerContext> private ChannelSink -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAfter(String baseName, String name, ChannelHandler handler) Inserts aChannelHandlerafter an existing handler of this pipeline.voidaddBefore(String baseName, String name, ChannelHandler handler) Inserts aChannelHandlerbefore an existing handler of this pipeline.voidaddFirst(String name, ChannelHandler handler) Inserts aChannelHandlerat the first position of this pipeline.voidaddLast(String name, ChannelHandler handler) Appends aChannelHandlerat the last position of this pipeline.voidattach(Channel channel, ChannelSink sink) Attaches this pipeline to the specifiedChannelandChannelSink.private voidprivate static voidprivate static voidprivate static voidprivate voidcheckDuplicateName(String name) Schedules the specified task to be executed in the I/O thread associated with this pipeline'sChannel.<T extends ChannelHandler>
TReturns theChannelHandlerof the specified type in this pipeline.Returns theChannelHandlerwith the specified name in this pipeline.Returns theChannelthat this pipeline is attached to.getContext(Class<? extends ChannelHandler> handlerType) Returns the context object of theChannelHandlerof the specified type in this pipeline.getContext(String name) Returns the context object of theChannelHandlerwith the specified name in this pipeline.getContext(ChannelHandler handler) Returns the context object of the specifiedChannelHandlerin this pipeline.getContextOrDie(Class<? extends ChannelHandler> handlerType) getContextOrDie(String name) getContextOrDie(ChannelHandler handler) getFirst()Returns the firstChannelHandlerin this pipeline.getLast()Returns the lastChannelHandlerin this pipeline.getNames()Returns theListof the handler names.getSink()Returns theChannelSinkthat this pipeline is attached to.private voidinit(String name, ChannelHandler handler) booleanReturnstrueif and only if this pipeline is attached to aChannel.protected void<T extends ChannelHandler>
TRemoves theChannelHandlerof the specified type from this pipelineRemoves theChannelHandlerwith the specified name from this pipeline.voidremove(ChannelHandler handler) Removes the specifiedChannelHandlerfrom this pipeline.Removes the firstChannelHandlerin this pipeline.Removes the lastChannelHandlerin this pipeline.<T extends ChannelHandler>
Treplace(Class<T> oldHandlerType, String newName, ChannelHandler newHandler) Replaces theChannelHandlerof the specified type with a new handler in this pipeline.replace(String oldName, String newName, ChannelHandler newHandler) Replaces theChannelHandlerof the specified name with a new handler in this pipeline.voidreplace(ChannelHandler oldHandler, String newName, ChannelHandler newHandler) Replaces the specifiedChannelHandlerwith a new handler in this pipeline.private ChannelHandlerreplace(DefaultChannelPipeline.DefaultChannelHandlerContext ctx, String newName, ChannelHandler newHandler) voidSends the specifiedChannelEventto the lastChannelDownstreamHandlerin this pipeline.(package private) voidvoidSends the specifiedChannelEventto the firstChannelUpstreamHandlerin this pipeline.(package private) voidtoMap()Converts this pipeline into an orderedMapwhose keys are handler names and whose values are handlers.toString()Returns theStringrepresentation of this pipeline.
-
Field Details
-
logger
-
discardingSink
-
channel
-
sink
-
head
-
tail
-
name2ctx
-
-
Constructor Details
-
DefaultChannelPipeline
public DefaultChannelPipeline()
-
-
Method Details
-
getChannel
Description copied from interface:ChannelPipelineReturns theChannelthat this pipeline is attached to.- Specified by:
getChannelin interfaceChannelPipeline- Returns:
- the channel.
nullif this pipeline is not attached yet.
-
getSink
Description copied from interface:ChannelPipelineReturns theChannelSinkthat this pipeline is attached to.- Specified by:
getSinkin interfaceChannelPipeline- Returns:
- the sink.
nullif this pipeline is not attached yet.
-
attach
Description copied from interface:ChannelPipelineAttaches this pipeline to the specifiedChannelandChannelSink. Once a pipeline is attached, it can't be detached nor attached again.- Specified by:
attachin interfaceChannelPipeline
-
isAttached
public boolean isAttached()Description copied from interface:ChannelPipelineReturnstrueif and only if this pipeline is attached to aChannel.- Specified by:
isAttachedin interfaceChannelPipeline
-
addFirst
Description copied from interface:ChannelPipelineInserts aChannelHandlerat the first position of this pipeline.- Specified by:
addFirstin interfaceChannelPipeline- Parameters:
name- the name of the handler to insert firsthandler- the handler to insert first
-
addLast
Description copied from interface:ChannelPipelineAppends aChannelHandlerat the last position of this pipeline.- Specified by:
addLastin interfaceChannelPipeline- Parameters:
name- the name of the handler to appendhandler- the handler to append
-
addBefore
Description copied from interface:ChannelPipelineInserts aChannelHandlerbefore an existing handler of this pipeline.- Specified by:
addBeforein interfaceChannelPipeline- Parameters:
baseName- the name of the existing handlername- the name of the handler to insert beforehandler- the handler to insert before
-
addAfter
Description copied from interface:ChannelPipelineInserts aChannelHandlerafter an existing handler of this pipeline.- Specified by:
addAfterin interfaceChannelPipeline- Parameters:
baseName- the name of the existing handlername- the name of the handler to insert afterhandler- the handler to insert after
-
remove
Description copied from interface:ChannelPipelineRemoves the specifiedChannelHandlerfrom this pipeline.- Specified by:
removein interfaceChannelPipeline
-
remove
Description copied from interface:ChannelPipelineRemoves theChannelHandlerwith the specified name from this pipeline.- Specified by:
removein interfaceChannelPipeline- Returns:
- the removed handler
-
remove
Description copied from interface:ChannelPipelineRemoves theChannelHandlerof the specified type from this pipeline- Specified by:
removein interfaceChannelPipeline- Type Parameters:
T- the type of the handler- Parameters:
handlerType- the type of the handler- Returns:
- the removed handler
-
remove
-
removeFirst
Description copied from interface:ChannelPipelineRemoves the firstChannelHandlerin this pipeline.- Specified by:
removeFirstin interfaceChannelPipeline- Returns:
- the removed handler
-
removeLast
Description copied from interface:ChannelPipelineRemoves the lastChannelHandlerin this pipeline.- Specified by:
removeLastin interfaceChannelPipeline- Returns:
- the removed handler
-
replace
Description copied from interface:ChannelPipelineReplaces the specifiedChannelHandlerwith a new handler in this pipeline.- Specified by:
replacein interfaceChannelPipeline
-
replace
Description copied from interface:ChannelPipelineReplaces theChannelHandlerof the specified name with a new handler in this pipeline.- Specified by:
replacein interfaceChannelPipeline- Returns:
- the removed handler
-
replace
public <T extends ChannelHandler> T replace(Class<T> oldHandlerType, String newName, ChannelHandler newHandler) Description copied from interface:ChannelPipelineReplaces theChannelHandlerof the specified type with a new handler in this pipeline.- Specified by:
replacein interfaceChannelPipeline- Returns:
- the removed handler
-
replace
private ChannelHandler replace(DefaultChannelPipeline.DefaultChannelHandlerContext ctx, String newName, ChannelHandler newHandler) -
callBeforeAdd
-
callAfterAdd
-
callBeforeRemove
-
callAfterRemove
-
getFirst
Description copied from interface:ChannelPipelineReturns the firstChannelHandlerin this pipeline.- Specified by:
getFirstin interfaceChannelPipeline- Returns:
- the first handler.
nullif this pipeline is empty.
-
getLast
Description copied from interface:ChannelPipelineReturns the lastChannelHandlerin this pipeline.- Specified by:
getLastin interfaceChannelPipeline- Returns:
- the last handler.
nullif this pipeline is empty.
-
get
Description copied from interface:ChannelPipelineReturns theChannelHandlerwith the specified name in this pipeline.- Specified by:
getin interfaceChannelPipeline- Returns:
- the handler with the specified name.
nullif there's no such handler in this pipeline.
-
get
Description copied from interface:ChannelPipelineReturns theChannelHandlerof the specified type in this pipeline.- Specified by:
getin interfaceChannelPipeline- Returns:
- the handler of the specified handler type.
nullif there's no such handler in this pipeline.
-
getContext
Description copied from interface:ChannelPipelineReturns the context object of theChannelHandlerwith the specified name in this pipeline.- Specified by:
getContextin interfaceChannelPipeline- Returns:
- the context object of the handler with the specified name.
nullif there's no such handler in this pipeline.
-
getContext
Description copied from interface:ChannelPipelineReturns the context object of the specifiedChannelHandlerin this pipeline.- Specified by:
getContextin interfaceChannelPipeline- Returns:
- the context object of the specified handler.
nullif there's no such handler in this pipeline.
-
getContext
Description copied from interface:ChannelPipelineReturns the context object of theChannelHandlerof the specified type in this pipeline.- Specified by:
getContextin interfaceChannelPipeline- Returns:
- the context object of the handler of the specified type.
nullif there's no such handler in this pipeline.
-
getNames
Description copied from interface:ChannelPipelineReturns theListof the handler names.- Specified by:
getNamesin interfaceChannelPipeline
-
toMap
Description copied from interface:ChannelPipelineConverts this pipeline into an orderedMapwhose keys are handler names and whose values are handlers.- Specified by:
toMapin interfaceChannelPipeline
-
toString
-
sendUpstream
Description copied from interface:ChannelPipelineSends the specifiedChannelEventto the firstChannelUpstreamHandlerin this pipeline.- Specified by:
sendUpstreamin interfaceChannelPipeline
-
sendUpstream
-
sendDownstream
Description copied from interface:ChannelPipelineSends the specifiedChannelEventto the lastChannelDownstreamHandlerin this pipeline.- Specified by:
sendDownstreamin interfaceChannelPipeline
-
sendDownstream
-
getActualUpstreamContext
private DefaultChannelPipeline.DefaultChannelHandlerContext getActualUpstreamContext(DefaultChannelPipeline.DefaultChannelHandlerContext ctx) -
getActualDownstreamContext
private DefaultChannelPipeline.DefaultChannelHandlerContext getActualDownstreamContext(DefaultChannelPipeline.DefaultChannelHandlerContext ctx) -
execute
Description copied from interface:ChannelPipelineSchedules the specified task to be executed in the I/O thread associated with this pipeline'sChannel.- Specified by:
executein interfaceChannelPipeline
-
notifyHandlerException
-
init
-
checkDuplicateName
-
getContextOrDie
-
getContextOrDie
-
getContextOrDie
private DefaultChannelPipeline.DefaultChannelHandlerContext getContextOrDie(Class<? extends ChannelHandler> handlerType)
-