Top Description Inners Fields Constructors Methods
io.netty5.channel

public abstract Class DefaultChannelPipeline

extends Object
implements ChannelPipeline
Class Inheritance
All Implemented Interfaces
io.netty5.channel.ChannelPipeline, java.lang.Iterable, io.netty5.channel.ChannelOutboundInvoker, io.netty5.util.concurrent.FuturePromiseFactory, io.netty5.channel.ChannelInboundInvoker
Known Direct Subclasses
io.netty5.channel.AbstractChannel.DefaultAbstractChannelPipeline
Imports
io.netty5.buffer.BufferAllocator, io.netty5.util.Resource, .ResourceLeakDetector, io.netty5.util.concurrent.EventExecutor, .FastThreadLocal, .Future, .Promise, io.netty5.util.internal.StringUtil, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.net.SocketAddress, java.util.ArrayList, .Collections, .Iterator, .LinkedHashMap, .List, .Map, .NoSuchElementException, .WeakHashMap, java.util.concurrent.atomic.AtomicLongFieldUpdater, .AtomicReferenceFieldUpdater, java.util.function.IntSupplier, .Predicate

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
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final Channel
pack-priv static final ReadBufferAllocator
private static final AtomicReferenceFieldUpdater<DefaultChannelPipeline, MessageSizeEstimator.Handle>
private volatile MessageSizeEstimator.Handle
private final List<DefaultChannelHandlerContext>
private final DefaultChannelHandlerContext
private static final ChannelHandler
private static final String
private static final InternalLogger
private static final FastThreadLocal<Map<Class<?>, String>>
private volatile long
private final Future<Void>
private final DefaultChannelHandlerContext
private static final ChannelHandler
private static final String
private static final AtomicLongFieldUpdater<DefaultChannelPipeline>
private final boolean

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.netty5.channel.ChannelPipeline.addAfter.

Inserts a ChannelHandler after an existing handler of this pipeline.
private 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.netty5.channel.ChannelPipeline.addBefore.

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

Implements io.netty5.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.netty5.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.netty5.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.netty5.channel.ChannelPipeline.addLast.

Inserts ChannelHandlers at the last position of this pipeline.
private void
public final Future<Void>
bind(SocketAddress localAddress)

Implements io.netty5.channel.ChannelOutboundInvoker.bind.

Request to bind to the given SocketAddress and notify the Future once the operation completes, either because the operation was successful or because of an error.
protected abstract void
bindTransport(SocketAddress localAddress, Promise<Void> promise)

Bind the SocketAddress to the transport and notify the Promise once the operation was completed.

private void
private void
public final Channel
channel()

Implements io.netty5.channel.ChannelPipeline.channel.

Returns the Channel that this pipeline is attached to.
private void
private static void
private static int
checkNoSuchElement(int idx, String name)

public final Future<Void>
close()

Implements io.netty5.channel.ChannelOutboundInvoker.close.

Request to close the Channel and notify the Future once the operation completes, either because the operation was successful or because of an error.
protected abstract void
closeTransport(Promise<Void> promise)

Close the transport and notify the Promise once the operation was completed.

public final Future<Void>
connect(SocketAddress remoteAddress)

Implements io.netty5.channel.ChannelOutboundInvoker.connect.

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

Implements io.netty5.channel.ChannelOutboundInvoker.connect.

Request to connect to the given SocketAddress while bind to the localAddress and notify the Future once the operation completes, either because the operation was successful or because of an error.
protected abstract void
connectTransport(SocketAddress remoteAddress, SocketAddress localAddress, Promise<Void> promise)

Connect the transport with the given remote SocketAddress.

public final ChannelHandlerContext
context(String name)

Implements io.netty5.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.netty5.channel.ChannelPipeline.context.

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

Implements io.netty5.channel.ChannelPipeline.context.

Returns the context object of the ChannelHandler of the specified type in this pipeline.
pack-priv final void
decrementPendingOutboundBytes(long
the number of bytes to remove.
delta
)

Decrements the pendingOutboundBytes() of the pipeline by the given delta.

private static DefaultChannelPipeline
public final Future<Void>
deregister()

Implements io.netty5.channel.ChannelOutboundInvoker.deregister.

Request to deregister from the previous assigned EventExecutor and notify the Future once the operation completes, either because the operation was successful or because of an error.
protected abstract void
deregisterTransport(Promise<Void> promise)

Deregister the transport of the EventLoop and notify the Promise once the operation was completed.

public final Future<Void>
disconnect()

Implements io.netty5.channel.ChannelOutboundInvoker.disconnect.

Request to disconnect from the remote peer and notify the Future once the operation completes, either because the operation was successful or because of an error.
protected abstract void
disconnectTransport(Promise<Void> promise)

Disconnect the transport and notify the Promise once the operation was completed.

pack-priv final MessageSizeEstimator.Handle
public final EventExecutor
executor()

Implements io.netty5.channel.ChannelOutboundInvoker.executor.

Returns the EventExecutor that is used to execute the operations of this ChannelOutboundInvoker.
private DefaultChannelHandlerContext
private int
public final ChannelPipeline
fireChannelActive()

Implements io.netty5.channel.ChannelPipeline.fireChannelActive.

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

Implements io.netty5.channel.ChannelPipeline.fireChannelInactive.

A Channel is inactive now, which means it is closed.
public final ChannelPipeline
fireChannelInboundEvent(Object event)

Implements io.netty5.channel.ChannelPipeline.fireChannelInboundEvent.

A Channel received a custom defined inbound event.
public final ChannelPipeline
public final ChannelPipeline
public final ChannelPipeline
public final ChannelPipeline
public final ChannelPipeline
public final ChannelPipeline
public ChannelHandler
first()

Overrides default io.netty5.channel.ChannelPipeline.first.

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

Implements io.netty5.channel.ChannelPipeline.firstContext.

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

Implements io.netty5.channel.ChannelPipeline.flush.

Request to flush all pending messages via this ChannelOutboundInvoker.
protected abstract void
flushTransport()

Flush out all (previous) scheduled write operations, scheduled via writeTransport(Object, Promise).

pack-priv final void
private String
private static String
generateName0(Class<?> handlerType)

public final ChannelHandler
get(String name)

Implements io.netty5.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.netty5.channel.ChannelPipeline.get.

Returns the ChannelHandler of the specified type in this pipeline.
pack-priv final void
incrementPendingOutboundBytes(long
the number of bytes to add.
delta
)

Increments the pendingOutboundBytes() of the pipeline by the given delta.

protected abstract boolean

Returns:

true if disconnecting is supported by the transport.
isTransportSupportingDisconnect
()

Returns true if and only if the transport has the disconnect() operation that allows a user to disconnect and then connect again.

public Iterator<Map.Entry<String, ChannelHandler>>
iterator()

Implements java.lang.Iterable.iterator.

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

Overrides default io.netty5.channel.ChannelPipeline.last.

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

Implements io.netty5.channel.ChannelPipeline.lastContext.

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

Overrides default io.netty5.channel.ChannelPipeline.names.

Returns the List of the handler names.
private DefaultChannelHandlerContext
public final <V> Future<V>
newFailedFuture(Throwable cause)

Overrides default io.netty5.channel.ChannelOutboundInvoker.newFailedFuture.

Create a new Future which is marked as failed already.
public final <V> Promise<V>
public final Future<Void>
newSucceededFuture()

Overrides default io.netty5.channel.ChannelOutboundInvoker.newSucceededFuture.

Create a new Future which is marked as succeeded already.
public final <V> Future<V>
newSucceededFuture(V value)

Overrides default io.netty5.channel.ChannelOutboundInvoker.newSucceededFuture.

Create a new Future which is marked as succeeded already.
protected void
onUnhandledChannelInboundEvent(Object evt)

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

protected void
protected void
protected void
protected void
protected void
protected void
protected void
onUnhandledInboundMessage(ChannelHandlerContext ctx, Object msg)

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

public final long
pendingOutboundBytes()

Implements io.netty5.channel.ChannelPipeline.pendingOutboundBytes.

The number of the outbound bytes that are buffered / queued in this ChannelPipeline.
protected abstract void
pendingOutboundBytesUpdated(long pendingOutboundBytes)

Called once the pendingOutboundBytes() were changed.

public final ChannelPipeline
public final ChannelPipeline
read(ReadBufferAllocator
The ReadBufferAllocator that should be used to allocate a Buffer if needed (for reading the data).
readBufferAllocator
)

Implements io.netty5.channel.ChannelPipeline.read.

Request to read data from the Channel, triggers an ChannelHandler#channelRead(ChannelHandlerContext, Object) event if data was read, and triggers a channelReadComplete event so the handler can decide to continue reading.
protected abstract void
readTransport(ReadBufferAllocator readBufferAllocator)

Schedules a read operation on the transport that fills the inbound buffer of the first ChannelHandler in the ChannelPipeline.

public final Future<Void>
register()

Implements io.netty5.channel.ChannelOutboundInvoker.register.

Request to register on the EventExecutor for I/O processing.
protected abstract void
registerTransport(Promise<Void> promise)

Register the transport and notify the Promise once the operation was completed.

public final ChannelPipeline
remove(ChannelHandler
the ChannelHandler to remove
handler
)

Overrides default io.netty5.channel.ChannelPipeline.remove.

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

Overrides default io.netty5.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
)

Overrides default io.netty5.channel.ChannelPipeline.remove.

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

Implements io.netty5.channel.ChannelPipeline.removeFirst.

Removes the first ChannelHandler in this pipeline.
public final <T extends ChannelHandler> T
removeIfExists(String
the name under which the ChannelHandler was stored.
name
)

Implements io.netty5.channel.ChannelPipeline.removeIfExists.

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

Implements io.netty5.channel.ChannelPipeline.removeIfExists.

Removes the ChannelHandler of the specified type from this pipeline if it exists.
public final <T extends ChannelHandler> T
removeIfExists(ChannelHandler
the ChannelHandler to remove
handler
)

Implements io.netty5.channel.ChannelPipeline.removeIfExists.

Removes the specified ChannelHandler from this pipeline if it exists
private <T extends ChannelHandler> T
public ChannelHandler
removeLast()

Implements io.netty5.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.netty5.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.netty5.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.netty5.channel.ChannelPipeline.replace.

Replaces the ChannelHandler of the specified type with a new handler in this pipeline.
private ChannelHandler
private void
private <T extends ChannelHandler> T
public final Future<Void>
protected abstract void
sendOutboundEventTransport(Object event, Promise<Void> promise)

Send a custom outbound event on the transport.

public Future<Void>
shutdown(ChannelShutdownDirection direction)

Implements io.netty5.channel.ChannelOutboundInvoker.shutdown.

Request shutdown one direction of the Channel and notify the Future once the operation completes, either because the operation was successful or because of an error.
protected abstract void
shutdownTransport(ChannelShutdownDirection direction, Promise<Void> promise)

Shutdown the given direction of the transport and notify the Promise once the operation was completed.

public Map<String, ChannelHandler>
toMap()

Implements io.netty5.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
protected abstract EventExecutor

Returns:

executor.
transportExecutor
()

Returns the EventExecutor that is used for all the abstract transport operations.

public final Future<Void>
write(Object msg)

Implements io.netty5.channel.ChannelOutboundInvoker.write.

Request to write a message via this ChannelHandlerContext through the ChannelPipeline.
public final Future<Void>
protected abstract void
writeTransport(Object msg, Promise<Void> promise)

Schedules a write operation on the transport.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait