Top Description Inners Fields Constructors Methods
io.netty.channel

public Class DefaultChannelPipeline

extends Object
implements ChannelPipeline
Class Inheritance
All Implemented Interfaces
io.netty.channel.ChannelPipeline, java.lang.Iterable, io.netty.channel.ChannelOutboundInvoker, io.netty.channel.ChannelInboundInvoker
Known Direct Subclasses
io.netty.channel.embedded.EmbeddedChannel.EmbeddedChannelPipeline
Imports
io.netty.channel.Channel.Unsafe, io.netty.util.ReferenceCountUtil, .ResourceLeakDetector, io.netty.util.concurrent.EventExecutor, .EventExecutorGroup, .FastThreadLocal, io.netty.util.internal.ObjectUtil, .StringUtil, .UnstableApi, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.net.SocketAddress, java.util.ArrayList, .IdentityHashMap, .Iterator, .LinkedHashMap, .List, .Map, .NoSuchElementException, .WeakHashMap, java.util.concurrent.RejectedExecutionException, java.util.concurrent.atomic.AtomicReferenceFieldUpdater

The default ChannelPipeline implementation. It is usually created by a Channel implementation when the Channel is created.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
private class
private abstract static class
private class
pack-priv class

Field Summary

Modifier and TypeField and Description
private final Channel
private Map<EventExecutorGroup, EventExecutor>
private static final AtomicReferenceFieldUpdater<DefaultChannelPipeline, MessageSizeEstimator.Handle>
private volatile MessageSizeEstimator.Handle
private boolean
pack-priv final DefaultChannelPipeline.HeadContext
private static final String
pack-priv static final InternalLogger
private static final FastThreadLocal<Map<Class<?>, String>>
private DefaultChannelPipeline.PendingHandlerCallback
pendingHandlerCallbackHead

This is the head of a linked list that is processed by callHandlerAddedForAllHandlers() and so process all the pending callHandlerAdded0(AbstractChannelHandlerContext).

private boolean
registered

Set to true once the AbstractChannel is registered.Once set to true the value will never change.

private final ChannelFuture
pack-priv final DefaultChannelPipeline.TailContext
private static final String
private final boolean
private final VoidChannelPromise

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public final ChannelPipeline
addAfter(String
the name of the existing handler
baseName
,
String
the name of the handler to insert after
name
,
ChannelHandler
the handler to insert after
handler
)

Implements io.netty.channel.ChannelPipeline.addAfter.

Inserts a ChannelHandler after an existing handler of this pipeline.
public final ChannelPipeline
addAfter(EventExecutorGroup
the EventExecutorGroup which will be used to execute the ChannelHandler methods
group
,
String
the name of the existing handler
baseName
,
String
the name of the handler to insert after
name
,
ChannelHandler
the handler to insert after
handler
)

Implements io.netty.channel.ChannelPipeline.addAfter.

Inserts a ChannelHandler after an existing handler of this pipeline.
private static void
public final ChannelPipeline
addBefore(String
the name of the existing handler
baseName
,
String
the name of the handler to insert before
name
,
ChannelHandler
the handler to insert before
handler
)

Implements io.netty.channel.ChannelPipeline.addBefore.

Inserts a ChannelHandler before an existing handler of this pipeline.
public final ChannelPipeline
addBefore(EventExecutorGroup
the EventExecutorGroup which will be used to execute the ChannelHandler methods
group
,
String
the name of the existing handler
baseName
,
String
the name of the handler to insert before
name
,
ChannelHandler
the handler to insert before
handler
)

Implements io.netty.channel.ChannelPipeline.addBefore.

Inserts a ChannelHandler before an existing handler of this pipeline.
private static void
public final ChannelPipeline
addFirst(String
the name of the handler to insert first
name
,
ChannelHandler
the handler to insert first
handler
)

Implements io.netty.channel.ChannelPipeline.addFirst.

Inserts a ChannelHandler at the first position of this pipeline.
public final ChannelPipeline
addFirst(EventExecutorGroup
the EventExecutorGroup which will be used to execute the ChannelHandler methods
group
,
String
the name of the handler to insert first
name
,
ChannelHandler
the handler to insert first
handler
)

Implements io.netty.channel.ChannelPipeline.addFirst.

Inserts a ChannelHandler at the first position of this pipeline.
public final ChannelPipeline
public final ChannelPipeline
addFirst(ChannelHandler...
the handlers to insert first
handlers
)

Implements io.netty.channel.ChannelPipeline.addFirst.

Inserts ChannelHandlers at the first position of this pipeline.
public final ChannelPipeline
addFirst(EventExecutorGroup
the EventExecutorGroup which will be used to execute the ChannelHandlers methods.
executor
,
ChannelHandler...
the handlers to insert first
handlers
)

Implements io.netty.channel.ChannelPipeline.addFirst.

Inserts ChannelHandlers at the first position of this pipeline.
private void
public final ChannelPipeline
addLast(String
the name of the handler to append
name
,
ChannelHandler
the handler to append
handler
)

Implements io.netty.channel.ChannelPipeline.addLast.

Appends a ChannelHandler at the last position of this pipeline.
public final ChannelPipeline
addLast(EventExecutorGroup
the EventExecutorGroup which will be used to execute the ChannelHandler methods
group
,
String
the name of the handler to append
name
,
ChannelHandler
the handler to append
handler
)

Implements io.netty.channel.ChannelPipeline.addLast.

Appends a ChannelHandler at the last position of this pipeline.
public final ChannelPipeline
public final ChannelPipeline
addLast(ChannelHandler...
the handlers to insert last
handlers
)

Implements io.netty.channel.ChannelPipeline.addLast.

Inserts ChannelHandlers at the last position of this pipeline.
public final ChannelPipeline
addLast(EventExecutorGroup
the EventExecutorGroup which will be used to execute the ChannelHandlers methods.
executor
,
ChannelHandler...
the handlers to insert last
handlers
)

Implements io.netty.channel.ChannelPipeline.addLast.

Inserts ChannelHandlers at the last position of this pipeline.
private void
private synchronized void
atomicRemoveFromHandlerList(AbstractChannelHandlerContext ctx)

Method is synchronized to make the handler removal from the double linked list atomic.

public final ChannelFuture
bind(SocketAddress localAddress)

Implements io.netty.channel.ChannelOutboundInvoker.bind.

Request to bind to the given SocketAddress and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
public final ChannelFuture
bind(SocketAddress localAddress, ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.bind.

Request to bind to the given SocketAddress and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
private void
private void
private void
private void
private void
public final Channel
channel()

Implements io.netty.channel.ChannelPipeline.channel.

Returns the Channel that this pipeline is attached to.
private void
private static void
private EventExecutor
public final ChannelFuture
close()

Implements io.netty.channel.ChannelOutboundInvoker.close.

Request to close the Channel and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
public final ChannelFuture
close(ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.close.

Request to close the Channel and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
public final ChannelFuture
connect(SocketAddress remoteAddress)

Implements io.netty.channel.ChannelOutboundInvoker.connect.

Request to connect to the given SocketAddress and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
public final ChannelFuture
connect(SocketAddress remoteAddress, SocketAddress localAddress)

Implements io.netty.channel.ChannelOutboundInvoker.connect.

Request to connect to the given SocketAddress while bind to the localAddress and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
public final ChannelFuture
connect(SocketAddress remoteAddress, ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.connect.

Request to connect to the given SocketAddress and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
public final ChannelFuture
connect(SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.connect.

Request to connect to the given SocketAddress while bind to the localAddress and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
public final ChannelHandlerContext
context(String name)

Implements io.netty.channel.ChannelPipeline.context.

Returns the context object of the ChannelHandler with the specified name in this pipeline.
public final ChannelHandlerContext
context(ChannelHandler handler)

Implements io.netty.channel.ChannelPipeline.context.

Returns the context object of the specified ChannelHandler in this pipeline.
public final ChannelHandlerContext
context(Class<? extends ChannelHandler> handlerType)

Implements io.netty.channel.ChannelPipeline.context.

Returns the context object of the ChannelHandler of the specified type in this pipeline.
private AbstractChannelHandlerContext
protected void
public final ChannelFuture
deregister()

Implements io.netty.channel.ChannelOutboundInvoker.deregister.

Request to deregister from the previous assigned EventExecutor and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
public final ChannelFuture
deregister(final ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.deregister.

Request to deregister from the previous assigned EventExecutor and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
private synchronized void
destroy()

Removes all handlers from the pipeline one by one from tail (exclusive) to head (exclusive) to trigger handlerRemoved().

private void
destroyDown(Thread currentThread, AbstractChannelHandlerContext ctx, boolean inEventLoop)

private void
destroyUp(AbstractChannelHandlerContext ctx, boolean inEventLoop)

public final ChannelFuture
disconnect()

Implements io.netty.channel.ChannelOutboundInvoker.disconnect.

Request to disconnect from the remote peer and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
public final ChannelFuture
disconnect(ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.disconnect.

Request to disconnect from the remote peer and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
pack-priv final MessageSizeEstimator.Handle
private String
public final ChannelPipeline
fireChannelActive()

Implements io.netty.channel.ChannelPipeline.fireChannelActive.

A Channel is active now, which means it is connected.
public final ChannelPipeline
fireChannelInactive()

Implements io.netty.channel.ChannelPipeline.fireChannelInactive.

A Channel is inactive now, which means it is closed.
public final ChannelPipeline
public final ChannelPipeline
public final ChannelPipeline
public final ChannelPipeline
public final ChannelPipeline
public final ChannelPipeline
fireExceptionCaught(Throwable cause)

Implements io.netty.channel.ChannelPipeline.fireExceptionCaught.

A Channel received an Throwable in one of its inbound operations.
public final ChannelPipeline
public final ChannelHandler
first()

Implements io.netty.channel.ChannelPipeline.first.

Returns the first ChannelHandler in this pipeline.
public final ChannelHandlerContext
firstContext()

Implements io.netty.channel.ChannelPipeline.firstContext.

Returns the context of the first ChannelHandler in this pipeline.
public final ChannelPipeline
flush()

Implements io.netty.channel.ChannelPipeline.flush.

Request to flush all pending messages via this ChannelOutboundInvoker.
private String
private static String
generateName0(Class<?> handlerType)

public final ChannelHandler
get(String name)

Implements io.netty.channel.ChannelPipeline.get.

Returns the ChannelHandler with the specified name in this pipeline.
public final <T extends ChannelHandler> T
get(Class<T> handlerType)

Implements io.netty.channel.ChannelPipeline.get.

Returns the ChannelHandler of the specified type in this pipeline.
private AbstractChannelHandlerContext
private AbstractChannelHandlerContext
private AbstractChannelHandlerContext
getContextOrDie(Class<? extends ChannelHandler> handlerType)

protected void
pack-priv final void
public final Iterator<Map.Entry<String, ChannelHandler>>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public final ChannelHandler
last()

Implements io.netty.channel.ChannelPipeline.last.

Returns the last ChannelHandler in this pipeline.
public final ChannelHandlerContext
lastContext()

Implements io.netty.channel.ChannelPipeline.lastContext.

Returns the context of the last ChannelHandler in this pipeline.
public final List<String>
names()

Implements io.netty.channel.ChannelPipeline.names.

Returns the List of the handler names.
private AbstractChannelHandlerContext
public final ChannelFuture
newFailedFuture(Throwable cause)

Implements io.netty.channel.ChannelOutboundInvoker.newFailedFuture.

Create a new ChannelFuture which is marked as failed already.
public final ChannelProgressivePromise
public final ChannelPromise
public final ChannelFuture
newSucceededFuture()

Implements io.netty.channel.ChannelOutboundInvoker.newSucceededFuture.

Create a new ChannelFuture which is marked as succeeded already.
protected void
protected void
protected void
protected void
protected void
protected void
onUnhandledInboundMessage(Object msg)

Called once a message hit the end of the ChannelPipeline without been handled by the user in ChannelInboundHandler#channelRead(ChannelHandlerContext, Object).

protected void
onUnhandledInboundMessage(ChannelHandlerContext ctx, Object msg)

Called once a message hit the end of the ChannelPipeline without been handled by the user in ChannelInboundHandler#channelRead(ChannelHandlerContext, Object).

protected void
onUnhandledInboundUserEventTriggered(Object evt)

Called once an user event hit the end of the ChannelPipeline without been handled by the user in ChannelInboundHandler#userEventTriggered(ChannelHandlerContext, Object).

public final ChannelPipeline
read()

Implements io.netty.channel.ChannelOutboundInvoker.read.

Request to Read data from the Channel into the first inbound buffer, triggers an ChannelInboundHandler#channelRead(ChannelHandlerContext, Object) event if data was read, and triggers a channelReadComplete event so the handler can decide to continue reading.
public final ChannelPipeline
remove(ChannelHandler
the ChannelHandler to remove
handler
)

Implements io.netty.channel.ChannelPipeline.remove.

Removes the specified ChannelHandler from this pipeline.
public final ChannelHandler
remove(String
the name under which the ChannelHandler was stored.
name
)

Implements io.netty.channel.ChannelPipeline.remove.

Removes the ChannelHandler with the specified name from this pipeline.
public final <T extends ChannelHandler> T
remove(Class<T>
the type of the handler
handlerType
)

Implements io.netty.channel.ChannelPipeline.remove.

Removes the ChannelHandler of the specified type from this pipeline.
private AbstractChannelHandlerContext
public final ChannelHandler
removeFirst()

Implements io.netty.channel.ChannelPipeline.removeFirst.

Removes the first ChannelHandler in this pipeline.
public final <T extends ChannelHandler> T
public final <T extends ChannelHandler> T
removeIfExists(Class<T> handlerType)

public final <T extends ChannelHandler> T
private <T extends ChannelHandler> T
public final ChannelHandler
removeLast()

Implements io.netty.channel.ChannelPipeline.removeLast.

Removes the last ChannelHandler in this pipeline.
public final ChannelPipeline
replace(ChannelHandler
the ChannelHandler to be replaced
oldHandler
,
String
the name under which the replacement should be added
newName
,
ChannelHandler
the ChannelHandler which is used as replacement
newHandler
)

Implements io.netty.channel.ChannelPipeline.replace.

Replaces the specified ChannelHandler with a new handler in this pipeline.
public final ChannelHandler
replace(String
the name of the ChannelHandler to be replaced
oldName
,
String
the name under which the replacement should be added
newName
,
ChannelHandler
the ChannelHandler which is used as replacement
newHandler
)

Implements io.netty.channel.ChannelPipeline.replace.

Replaces the ChannelHandler of the specified name with a new handler in this pipeline.
public final <T extends ChannelHandler> T
replace(Class<T>
the type of the handler to be removed
oldHandlerType
,
String
the name under which the replacement should be added
newName
,
ChannelHandler
the ChannelHandler which is used as replacement
newHandler
)

Implements io.netty.channel.ChannelPipeline.replace.

Replaces the ChannelHandler of the specified type with a new handler in this pipeline.
private ChannelHandler
private static void
public final Map<String, ChannelHandler>
toMap()

Implements io.netty.channel.ChannelPipeline.toMap.

Converts this pipeline into an ordered Map whose keys are handler names and whose values are handlers.
public final String
toString()

Overrides java.lang.Object.toString.

Returns the String representation of this pipeline.
pack-priv final Object
public final ChannelPromise
voidPromise()

Implements io.netty.channel.ChannelOutboundInvoker.voidPromise.

Return a special ChannelPromise which can be reused for different operations.
public final ChannelFuture
write(Object msg)

Implements io.netty.channel.ChannelOutboundInvoker.write.

Request to write a message via this ChannelHandlerContext through the ChannelPipeline.
public final ChannelFuture
write(Object msg, ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.write.

Request to write a message via this ChannelHandlerContext through the ChannelPipeline.
public final ChannelFuture
public final ChannelFuture
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait