- java.lang.Object
-
- io.netty5.channel.DefaultChannelPipeline
-
- All Implemented Interfaces:
ChannelInboundInvoker
,ChannelOutboundInvoker
,ChannelPipeline
,FuturePromiseFactory
,Iterable<Map.Entry<String,ChannelHandler>>
- Direct Known Subclasses:
AbstractChannel.DefaultAbstractChannelPipeline
public abstract class DefaultChannelPipeline extends Object implements ChannelPipeline
The defaultChannelPipeline
implementation. It is usually created by aChannel
implementation when theChannel
is created.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultChannelPipeline(Channel channel)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ChannelPipeline
addAfter(String baseName, String name, ChannelHandler handler)
Inserts aChannelHandler
after an existing handler of this pipeline.ChannelPipeline
addBefore(String baseName, String name, ChannelHandler handler)
Inserts aChannelHandler
before an existing handler of this pipeline.ChannelPipeline
addFirst(ChannelHandler handler)
ChannelPipeline
addFirst(ChannelHandler... handlers)
InsertsChannelHandler
s at the first position of this pipeline.ChannelPipeline
addFirst(String name, ChannelHandler handler)
Inserts aChannelHandler
at the first position of this pipeline.ChannelPipeline
addLast(ChannelHandler handler)
ChannelPipeline
addLast(ChannelHandler... handlers)
InsertsChannelHandler
s at the last position of this pipeline.ChannelPipeline
addLast(String name, ChannelHandler handler)
Appends aChannelHandler
at the last position of this pipeline.Future<Void>
bind(SocketAddress localAddress)
Request to bind to the givenSocketAddress
and notify theFuture
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 theSocketAddress
to the transport and notify thePromise
once the operation was completed.Channel
channel()
Returns theChannel
that this pipeline is attached to.Future<Void>
close()
protected abstract void
closeTransport(Promise<Void> promise)
Close the transport and notify thePromise
once the operation was completed.Future<Void>
connect(SocketAddress remoteAddress)
Request to connect to the givenSocketAddress
and notify theFuture
once the operation completes, either because the operation was successful or because of an error.Future<Void>
connect(SocketAddress remoteAddress, SocketAddress localAddress)
Request to connect to the givenSocketAddress
while bind to the localAddress and notify theFuture
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 remoteSocketAddress
.ChannelHandlerContext
context(ChannelHandler handler)
Returns the context object of the specifiedChannelHandler
in this pipeline.ChannelHandlerContext
context(Class<? extends ChannelHandler> handlerType)
Returns the context object of theChannelHandler
of the specified type in this pipeline.ChannelHandlerContext
context(String name)
Returns the context object of theChannelHandler
with the specified name in this pipeline.Future<Void>
deregister()
Request to deregister from the previous assignedEventExecutor
and notify theFuture
once the operation completes, either because the operation was successful or because of an error.protected abstract void
deregisterTransport(Promise<Void> promise)
Future<Void>
disconnect()
Request to disconnect from the remote peer and notify theFuture
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 thePromise
once the operation was completed.EventExecutor
executor()
Returns theEventExecutor
that is used to execute the operations of thisChannelOutboundInvoker
.ChannelPipeline
fireChannelActive()
AChannel
is active now, which means it is connected.ChannelPipeline
fireChannelExceptionCaught(Throwable cause)
ChannelPipeline
fireChannelInactive()
AChannel
is inactive now, which means it is closed.ChannelPipeline
fireChannelInboundEvent(Object event)
AChannel
received a custom defined inbound event.ChannelPipeline
fireChannelRead(Object msg)
AChannel
received a message.ChannelPipeline
fireChannelReadComplete()
Triggers anChannelHandler.channelReadComplete(ChannelHandlerContext)
event to the nextChannelHandler
in theChannelPipeline
.ChannelPipeline
fireChannelRegistered()
ChannelPipeline
fireChannelShutdown(ChannelShutdownDirection direction)
AChannel
was shutdown in a specific direction.ChannelPipeline
fireChannelUnregistered()
ChannelPipeline
fireChannelWritabilityChanged()
Triggers anChannelHandler.channelWritabilityChanged(ChannelHandlerContext)
event to the nextChannelHandler
in theChannelPipeline
.ChannelHandler
first()
Returns the firstChannelHandler
in this pipeline.ChannelHandlerContext
firstContext()
Returns the context of the firstChannelHandler
in this pipeline.ChannelPipeline
flush()
Request to flush all pending messages via this ChannelOutboundInvoker.protected abstract void
flushTransport()
Flush out all (previous) scheduled write operations, scheduled viawriteTransport(Object, Promise)
.<T extends ChannelHandler>
Tget(Class<T> handlerType)
Returns theChannelHandler
of the specified type in this pipeline.ChannelHandler
get(String name)
Returns theChannelHandler
with the specified name in this pipeline.Iterator<Map.Entry<String,ChannelHandler>>
iterator()
ChannelHandler
last()
Returns the lastChannelHandler
in this pipeline.ChannelHandlerContext
lastContext()
Returns the context of the lastChannelHandler
in this pipeline.List<String>
names()
Returns theList
of the handler names.<V> Future<V>
newFailedFuture(Throwable cause)
Create a newFuture
which is marked as failed already.<V> Promise<V>
newPromise()
Return a newPromise
.Future<Void>
newSucceededFuture()
Create a newFuture
which is marked as succeeded already.<V> Future<V>
newSucceededFuture(V value)
Create a newFuture
which is marked as succeeded already.protected void
onUnhandledChannelInboundEvent(Object evt)
Called once an user event hit the end of theChannelPipeline
without been handled by the user inChannelHandler.channelInboundEvent(ChannelHandlerContext, Object)
.protected void
onUnhandledChannelWritabilityChanged()
Called once theChannelHandler.channelWritabilityChanged(ChannelHandlerContext)
event hit the end of theChannelPipeline
.protected void
onUnhandledInboundChannelActive()
Called once theChannelHandler.channelActive(ChannelHandlerContext)
event hit the end of theChannelPipeline
.protected void
onUnhandledInboundChannelInactive()
Called once theChannelHandler.channelInactive(ChannelHandlerContext)
event hit the end of theChannelPipeline
.protected void
onUnhandledInboundChannelReadComplete()
Called once theChannelHandler.channelReadComplete(ChannelHandlerContext)
event hit the end of theChannelPipeline
.protected void
onUnhandledInboundChannelShutdown(ChannelShutdownDirection direction)
Called once theChannelHandler.channelShutdown(ChannelHandlerContext, ChannelShutdownDirection)
event hit the end of theChannelPipeline
.protected void
onUnhandledInboundException(Throwable cause)
Called once aThrowable
hit the end of theChannelPipeline
without been handled by the user inChannelHandler.channelExceptionCaught(ChannelHandlerContext, Throwable)
.protected void
onUnhandledInboundMessage(ChannelHandlerContext ctx, Object msg)
Called once a message hit the end of theChannelPipeline
without been handled by the user inChannelHandler.channelRead(ChannelHandlerContext, Object)
.long
pendingOutboundBytes()
The number of the outbound bytes that are buffered / queued in thisChannelPipeline
.protected abstract void
pendingOutboundBytesUpdated(long pendingOutboundBytes)
Called once thependingOutboundBytes()
were changed.ChannelPipeline
read()
Request to Read data from theChannel
into the first inbound buffer, triggers anChannelHandler.channelRead(ChannelHandlerContext, Object)
event if data was read, and triggers achannelReadComplete
event so the handler can decide to continue reading.protected abstract void
readTransport()
Schedules a read operation on the transport that fills the inbound buffer of the firstChannelHandler
in theChannelPipeline
.Future<Void>
register()
Request to register on theEventExecutor
for I/O processing.protected abstract void
registerTransport(Promise<Void> promise)
Register the transport and notify thePromise
once the operation was completed.ChannelPipeline
remove(ChannelHandler handler)
Removes the specifiedChannelHandler
from this pipeline.<T extends ChannelHandler>
Tremove(Class<T> handlerType)
Removes theChannelHandler
of the specified type from this pipeline.ChannelHandler
remove(String name)
Removes theChannelHandler
with the specified name from this pipeline.ChannelHandler
removeFirst()
Removes the firstChannelHandler
in this pipeline.<T extends ChannelHandler>
TremoveIfExists(ChannelHandler handler)
Removes the specifiedChannelHandler
from this pipeline if it exists<T extends ChannelHandler>
TremoveIfExists(Class<T> handlerType)
Removes theChannelHandler
of the specified type from this pipeline if it exists.<T extends ChannelHandler>
TremoveIfExists(String name)
Removes theChannelHandler
with the specified name from this pipeline if it exists.ChannelHandler
removeLast()
Removes the lastChannelHandler
in this pipeline.ChannelPipeline
replace(ChannelHandler oldHandler, String newName, ChannelHandler newHandler)
Replaces the specifiedChannelHandler
with a new handler in this pipeline.<T extends ChannelHandler>
Treplace(Class<T> oldHandlerType, String newName, ChannelHandler newHandler)
Replaces theChannelHandler
of the specified type with a new handler in this pipeline.ChannelHandler
replace(String oldName, String newName, ChannelHandler newHandler)
Replaces theChannelHandler
of the specified name with a new handler in this pipeline.Future<Void>
sendOutboundEvent(Object event)
Send a custom outbound event via thisChannelOutboundInvoker
through theChannelPipeline
.protected abstract void
sendOutboundEventTransport(Object event, Promise<Void> promise)
Send a custom outbound event on the transport.Future<Void>
shutdown(ChannelShutdownDirection direction)
protected abstract void
shutdownTransport(ChannelShutdownDirection direction, Promise<Void> promise)
Shutdown the given direction of the transport and notify thePromise
once the operation was completed.Map<String,ChannelHandler>
toMap()
Converts this pipeline into an orderedMap
whose keys are handler names and whose values are handlers.String
toString()
Returns theString
representation of this pipeline.protected abstract EventExecutor
transportExecutor()
Returns theEventExecutor
that is used for all the abstract transport operations.Future<Void>
write(Object msg)
Request to write a message via thisChannelHandlerContext
through theChannelPipeline
.Future<Void>
writeAndFlush(Object msg)
Shortcut for callChannelOutboundInvoker.write(Object)
andChannelOutboundInvoker.flush()
.protected abstract void
writeTransport(Object msg, Promise<Void> promise)
Schedules a write operation on the transport.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty5.channel.ChannelPipeline
isEmpty
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
DefaultChannelPipeline
protected DefaultChannelPipeline(Channel channel)
-
-
Method Detail
-
channel
public final Channel channel()
Description copied from interface:ChannelPipeline
Returns theChannel
that this pipeline is attached to.- Specified by:
channel
in interfaceChannelPipeline
- Returns:
- the channel.
null
if this pipeline is not attached yet.
-
executor
public final EventExecutor executor()
Description copied from interface:ChannelOutboundInvoker
Returns theEventExecutor
that is used to execute the operations of thisChannelOutboundInvoker
.- Specified by:
executor
in interfaceChannelOutboundInvoker
- Returns:
- the executor.
-
addFirst
public final ChannelPipeline addFirst(String name, ChannelHandler handler)
Description copied from interface:ChannelPipeline
Inserts aChannelHandler
at the first position of this pipeline.- Specified by:
addFirst
in interfaceChannelPipeline
- Parameters:
name
- the name of the handler to insert firsthandler
- the handler to insert first
-
addLast
public final ChannelPipeline addLast(String name, ChannelHandler handler)
Description copied from interface:ChannelPipeline
Appends aChannelHandler
at the last position of this pipeline.- Specified by:
addLast
in interfaceChannelPipeline
- Parameters:
name
- the name of the handler to appendhandler
- the handler to append
-
addBefore
public final ChannelPipeline addBefore(String baseName, String name, ChannelHandler handler)
Description copied from interface:ChannelPipeline
Inserts aChannelHandler
before an existing handler of this pipeline.- Specified by:
addBefore
in interfaceChannelPipeline
- Parameters:
baseName
- the name of the existing handlername
- the name of the handler to insert beforehandler
- the handler to insert before
-
addAfter
public final ChannelPipeline addAfter(String baseName, String name, ChannelHandler handler)
Description copied from interface:ChannelPipeline
Inserts aChannelHandler
after an existing handler of this pipeline.- Specified by:
addAfter
in interfaceChannelPipeline
- Parameters:
baseName
- the name of the existing handlername
- the name of the handler to insert afterhandler
- the handler to insert after
-
addFirst
public final ChannelPipeline addFirst(ChannelHandler handler)
-
addFirst
public final ChannelPipeline addFirst(ChannelHandler... handlers)
Description copied from interface:ChannelPipeline
InsertsChannelHandler
s at the first position of this pipeline.null
handlers will be skipped.- Specified by:
addFirst
in interfaceChannelPipeline
- Parameters:
handlers
- the handlers to insert first
-
addLast
public final ChannelPipeline addLast(ChannelHandler handler)
-
addLast
public final ChannelPipeline addLast(ChannelHandler... handlers)
Description copied from interface:ChannelPipeline
InsertsChannelHandler
s at the last position of this pipeline.null
handlers will be skipped.- Specified by:
addLast
in interfaceChannelPipeline
- Parameters:
handlers
- the handlers to insert last
-
remove
public final ChannelPipeline remove(ChannelHandler handler)
Description copied from interface:ChannelPipeline
Removes the specifiedChannelHandler
from this pipeline.- Specified by:
remove
in interfaceChannelPipeline
- Parameters:
handler
- theChannelHandler
to remove
-
remove
public final ChannelHandler remove(String name)
Description copied from interface:ChannelPipeline
Removes theChannelHandler
with the specified name from this pipeline.- Specified by:
remove
in interfaceChannelPipeline
- Parameters:
name
- the name under which theChannelHandler
was stored.- Returns:
- the removed handler
-
remove
public final <T extends ChannelHandler> T remove(Class<T> handlerType)
Description copied from interface:ChannelPipeline
Removes theChannelHandler
of the specified type from this pipeline.- Specified by:
remove
in interfaceChannelPipeline
- Type Parameters:
T
- the type of the handler- Parameters:
handlerType
- the type of the handler- Returns:
- the removed handler
-
removeIfExists
public final <T extends ChannelHandler> T removeIfExists(String name)
Description copied from interface:ChannelPipeline
Removes theChannelHandler
with the specified name from this pipeline if it exists.- Specified by:
removeIfExists
in interfaceChannelPipeline
- Parameters:
name
- the name under which theChannelHandler
was stored.- Returns:
- the removed handler
-
removeIfExists
public final <T extends ChannelHandler> T removeIfExists(Class<T> handlerType)
Description copied from interface:ChannelPipeline
Removes theChannelHandler
of the specified type from this pipeline if it exists.- Specified by:
removeIfExists
in interfaceChannelPipeline
- Type Parameters:
T
- the type of the handler- Parameters:
handlerType
- the type of the handler- Returns:
- the removed handler or
null
if it didn't exist.
-
removeIfExists
public final <T extends ChannelHandler> T removeIfExists(ChannelHandler handler)
Description copied from interface:ChannelPipeline
Removes the specifiedChannelHandler
from this pipeline if it exists- Specified by:
removeIfExists
in interfaceChannelPipeline
- Parameters:
handler
- theChannelHandler
to remove- Returns:
- the removed handler or
null
if it didn't exist.
-
replace
public final ChannelPipeline replace(ChannelHandler oldHandler, String newName, ChannelHandler newHandler)
Description copied from interface:ChannelPipeline
Replaces the specifiedChannelHandler
with a new handler in this pipeline.- Specified by:
replace
in interfaceChannelPipeline
- Parameters:
oldHandler
- theChannelHandler
to be replacednewName
- the name under which the replacement should be addednewHandler
- theChannelHandler
which is used as replacement- Returns:
- itself
-
replace
public final ChannelHandler replace(String oldName, String newName, ChannelHandler newHandler)
Description copied from interface:ChannelPipeline
Replaces theChannelHandler
of the specified name with a new handler in this pipeline.- Specified by:
replace
in interfaceChannelPipeline
- Parameters:
oldName
- the name of theChannelHandler
to be replacednewName
- the name under which the replacement should be addednewHandler
- theChannelHandler
which is used as replacement- Returns:
- the removed handler
-
replace
public final <T extends ChannelHandler> T replace(Class<T> oldHandlerType, String newName, ChannelHandler newHandler)
Description copied from interface:ChannelPipeline
Replaces theChannelHandler
of the specified type with a new handler in this pipeline.- Specified by:
replace
in interfaceChannelPipeline
- Parameters:
oldHandlerType
- the type of the handler to be removednewName
- the name under which the replacement should be addednewHandler
- theChannelHandler
which is used as replacement- Returns:
- the removed handler
-
get
public final ChannelHandler get(String name)
Description copied from interface:ChannelPipeline
Returns theChannelHandler
with the specified name in this pipeline.- Specified by:
get
in interfaceChannelPipeline
- Returns:
- the handler with the specified name.
null
if there's no such handler in this pipeline.
-
get
public final <T extends ChannelHandler> T get(Class<T> handlerType)
Description copied from interface:ChannelPipeline
Returns theChannelHandler
of the specified type in this pipeline.- Specified by:
get
in interfaceChannelPipeline
- Returns:
- the handler of the specified handler type.
null
if there's no such handler in this pipeline.
-
context
public final ChannelHandlerContext context(String name)
Description copied from interface:ChannelPipeline
Returns the context object of theChannelHandler
with the specified name in this pipeline.- Specified by:
context
in interfaceChannelPipeline
- Returns:
- the context object of the handler with the specified name.
null
if there's no such handler in this pipeline.
-
context
public final ChannelHandlerContext context(ChannelHandler handler)
Description copied from interface:ChannelPipeline
Returns the context object of the specifiedChannelHandler
in this pipeline.- Specified by:
context
in interfaceChannelPipeline
- Returns:
- the context object of the specified handler.
null
if there's no such handler in this pipeline.
-
context
public final ChannelHandlerContext context(Class<? extends ChannelHandler> handlerType)
Description copied from interface:ChannelPipeline
Returns the context object of theChannelHandler
of the specified type in this pipeline.- Specified by:
context
in interfaceChannelPipeline
- Returns:
- the context object of the handler of the specified type.
null
if there's no such handler in this pipeline.
-
names
public final List<String> names()
Description copied from interface:ChannelPipeline
Returns theList
of the handler names.- Specified by:
names
in interfaceChannelPipeline
-
removeFirst
public ChannelHandler removeFirst()
Description copied from interface:ChannelPipeline
Removes the firstChannelHandler
in this pipeline.- Specified by:
removeFirst
in interfaceChannelPipeline
- Returns:
- the removed handler
-
removeLast
public ChannelHandler removeLast()
Description copied from interface:ChannelPipeline
Removes the lastChannelHandler
in this pipeline.- Specified by:
removeLast
in interfaceChannelPipeline
- Returns:
- the removed handler
-
first
public ChannelHandler first()
Description copied from interface:ChannelPipeline
Returns the firstChannelHandler
in this pipeline.- Specified by:
first
in interfaceChannelPipeline
- Returns:
- the first handler.
null
if this pipeline is empty.
-
firstContext
public ChannelHandlerContext firstContext()
Description copied from interface:ChannelPipeline
Returns the context of the firstChannelHandler
in this pipeline.- Specified by:
firstContext
in interfaceChannelPipeline
- Returns:
- the context of the first handler.
null
if this pipeline is empty.
-
last
public ChannelHandler last()
Description copied from interface:ChannelPipeline
Returns the lastChannelHandler
in this pipeline.- Specified by:
last
in interfaceChannelPipeline
- Returns:
- the last handler.
null
if this pipeline is empty.
-
lastContext
public ChannelHandlerContext lastContext()
Description copied from interface:ChannelPipeline
Returns the context of the lastChannelHandler
in this pipeline.- Specified by:
lastContext
in interfaceChannelPipeline
- Returns:
- the context of the last handler.
null
if this pipeline is empty.
-
toMap
public Map<String,ChannelHandler> toMap()
Description copied from interface:ChannelPipeline
Converts this pipeline into an orderedMap
whose keys are handler names and whose values are handlers.- Specified by:
toMap
in interfaceChannelPipeline
-
iterator
public Iterator<Map.Entry<String,ChannelHandler>> iterator()
- Specified by:
iterator
in interfaceIterable<Map.Entry<String,ChannelHandler>>
-
fireChannelRegistered
public final ChannelPipeline fireChannelRegistered()
Description copied from interface:ChannelInboundInvoker
AChannel
was registered to itsEventLoop
. This will result in having theChannelHandler.channelRegistered(ChannelHandlerContext)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
fireChannelRegistered
in interfaceChannelInboundInvoker
- Specified by:
fireChannelRegistered
in interfaceChannelPipeline
-
fireChannelUnregistered
public final ChannelPipeline fireChannelUnregistered()
Description copied from interface:ChannelInboundInvoker
AChannel
was unregistered from itsEventLoop
. This will result in having theChannelHandler.channelUnregistered(ChannelHandlerContext)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
fireChannelUnregistered
in interfaceChannelInboundInvoker
- Specified by:
fireChannelUnregistered
in interfaceChannelPipeline
-
fireChannelActive
public final ChannelPipeline fireChannelActive()
Description copied from interface:ChannelInboundInvoker
AChannel
is active now, which means it is connected. This will result in having theChannelHandler.channelActive(ChannelHandlerContext)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
fireChannelActive
in interfaceChannelInboundInvoker
- Specified by:
fireChannelActive
in interfaceChannelPipeline
-
fireChannelInactive
public final ChannelPipeline fireChannelInactive()
Description copied from interface:ChannelInboundInvoker
AChannel
is inactive now, which means it is closed. This will result in having theChannelHandler.channelInactive(ChannelHandlerContext)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
fireChannelInactive
in interfaceChannelInboundInvoker
- Specified by:
fireChannelInactive
in interfaceChannelPipeline
-
fireChannelShutdown
public final ChannelPipeline fireChannelShutdown(ChannelShutdownDirection direction)
Description copied from interface:ChannelInboundInvoker
AChannel
was shutdown in a specific direction. This will result in having theChannelHandler.channelShutdown(ChannelHandlerContext, ChannelShutdownDirection)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
fireChannelShutdown
in interfaceChannelInboundInvoker
- Specified by:
fireChannelShutdown
in interfaceChannelPipeline
-
fireChannelExceptionCaught
public final ChannelPipeline fireChannelExceptionCaught(Throwable cause)
Description copied from interface:ChannelInboundInvoker
AChannel
received anThrowable
in one of its inbound operations. This will result in having theChannelHandler.channelExceptionCaught(ChannelHandlerContext, Throwable)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
fireChannelExceptionCaught
in interfaceChannelInboundInvoker
- Specified by:
fireChannelExceptionCaught
in interfaceChannelPipeline
-
fireChannelInboundEvent
public final ChannelPipeline fireChannelInboundEvent(Object event)
Description copied from interface:ChannelInboundInvoker
AChannel
received a custom defined inbound event. This will result in having theChannelHandler.channelInboundEvent(ChannelHandlerContext, Object)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
fireChannelInboundEvent
in interfaceChannelInboundInvoker
- Specified by:
fireChannelInboundEvent
in interfaceChannelPipeline
-
fireChannelRead
public final ChannelPipeline fireChannelRead(Object msg)
Description copied from interface:ChannelInboundInvoker
AChannel
received a message. This will result in having theChannelHandler.channelRead(ChannelHandlerContext, Object)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
fireChannelRead
in interfaceChannelInboundInvoker
- Specified by:
fireChannelRead
in interfaceChannelPipeline
-
fireChannelReadComplete
public final ChannelPipeline fireChannelReadComplete()
Description copied from interface:ChannelInboundInvoker
Triggers anChannelHandler.channelReadComplete(ChannelHandlerContext)
event to the nextChannelHandler
in theChannelPipeline
.- Specified by:
fireChannelReadComplete
in interfaceChannelInboundInvoker
- Specified by:
fireChannelReadComplete
in interfaceChannelPipeline
-
fireChannelWritabilityChanged
public final ChannelPipeline fireChannelWritabilityChanged()
Description copied from interface:ChannelInboundInvoker
Triggers anChannelHandler.channelWritabilityChanged(ChannelHandlerContext)
event to the nextChannelHandler
in theChannelPipeline
.- Specified by:
fireChannelWritabilityChanged
in interfaceChannelInboundInvoker
- Specified by:
fireChannelWritabilityChanged
in interfaceChannelPipeline
-
bind
public final Future<Void> bind(SocketAddress localAddress)
Description copied from interface:ChannelOutboundInvoker
Request to bind to the givenSocketAddress
and notify theFuture
once the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.bind(ChannelHandlerContext, SocketAddress)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
bind
in interfaceChannelOutboundInvoker
-
connect
public final Future<Void> connect(SocketAddress remoteAddress)
Description copied from interface:ChannelOutboundInvoker
Request to connect to the givenSocketAddress
and notify theFuture
once the operation completes, either because the operation was successful or because of an error.If the connection fails because of a connection timeout, the
Future
will get failed with aConnectTimeoutException
. If it fails because of connection refused aConnectException
will be used.This will result in having the
ChannelHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
connect
in interfaceChannelOutboundInvoker
-
connect
public final Future<Void> connect(SocketAddress remoteAddress, SocketAddress localAddress)
Description copied from interface:ChannelOutboundInvoker
Request to connect to the givenSocketAddress
while bind to the localAddress and notify theFuture
once the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
connect
in interfaceChannelOutboundInvoker
-
disconnect
public final Future<Void> disconnect()
Description copied from interface:ChannelOutboundInvoker
Request to disconnect from the remote peer and notify theFuture
once the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.disconnect(ChannelHandlerContext)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
disconnect
in interfaceChannelOutboundInvoker
-
close
public final Future<Void> close()
Description copied from interface:ChannelOutboundInvoker
Request to close theChannel
and notify theFuture
once the operation completes, either because the operation was successful or because of an error. After it is closed it is not possible to reuse it again.This will result in having the
ChannelHandler.close(ChannelHandlerContext)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
close
in interfaceChannelOutboundInvoker
-
shutdown
public Future<Void> shutdown(ChannelShutdownDirection direction)
Description copied from interface:ChannelOutboundInvoker
Request shutdown one direction of theChannel
and notify theFuture
once the operation completes, either because the operation was successful or because of an error.When completed, the channel will either not produce any inbound data anymore, or it will not be possible to write data anymore, depending on the given
ChannelShutdownDirection
.Depending on the transport implementation shutting down the
ChannelShutdownDirection.Outbound
orChannelShutdownDirection.Inbound
might also result in data transferred over the network. Like for example in case of TCP shutting down theChannelShutdownDirection.Outbound
will result in aFIN
that is transmitted to the remote peer that will as a result shutdownChannelShutdownDirection.Inbound
.This will result in having the
ChannelHandler.shutdown(ChannelHandlerContext, ChannelShutdownDirection)
. method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
shutdown
in interfaceChannelOutboundInvoker
-
register
public final Future<Void> register()
Description copied from interface:ChannelOutboundInvoker
Request to register on theEventExecutor
for I/O processing.Future
once the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.register(ChannelHandlerContext)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
register
in interfaceChannelOutboundInvoker
-
deregister
public final Future<Void> deregister()
Description copied from interface:ChannelOutboundInvoker
Request to deregister from the previous assignedEventExecutor
and notify theFuture
once the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.deregister(ChannelHandlerContext)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
deregister
in interfaceChannelOutboundInvoker
-
flush
public final ChannelPipeline flush()
Description copied from interface:ChannelOutboundInvoker
Request to flush all pending messages via this ChannelOutboundInvoker.- Specified by:
flush
in interfaceChannelOutboundInvoker
- Specified by:
flush
in interfaceChannelPipeline
-
read
public final ChannelPipeline read()
Description copied from interface:ChannelOutboundInvoker
Request to Read data from theChannel
into the first inbound buffer, triggers anChannelHandler.channelRead(ChannelHandlerContext, Object)
event if data was read, and triggers achannelReadComplete
event so the handler can decide to continue reading. If there's a pending read operation already, this method does nothing.This will result in having the
ChannelHandler.read(ChannelHandlerContext)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
read
in interfaceChannelOutboundInvoker
-
write
public final Future<Void> write(Object msg)
Description copied from interface:ChannelOutboundInvoker
Request to write a message via thisChannelHandlerContext
through theChannelPipeline
. This method will not request to actual flush, so be sure to callChannelOutboundInvoker.flush()
once you want to request to flush all pending data to the actual transport.- Specified by:
write
in interfaceChannelOutboundInvoker
-
writeAndFlush
public final Future<Void> writeAndFlush(Object msg)
Description copied from interface:ChannelOutboundInvoker
Shortcut for callChannelOutboundInvoker.write(Object)
andChannelOutboundInvoker.flush()
.- Specified by:
writeAndFlush
in interfaceChannelOutboundInvoker
-
sendOutboundEvent
public final Future<Void> sendOutboundEvent(Object event)
Description copied from interface:ChannelOutboundInvoker
Send a custom outbound event via thisChannelOutboundInvoker
through theChannelPipeline
.This will result in having the
ChannelHandler.sendOutboundEvent(ChannelHandlerContext, Object)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
sendOutboundEvent
in interfaceChannelOutboundInvoker
-
newPromise
public final <V> Promise<V> newPromise()
Description copied from interface:FuturePromiseFactory
Return a newPromise
.- Specified by:
newPromise
in interfaceChannelOutboundInvoker
- Specified by:
newPromise
in interfaceFuturePromiseFactory
-
newSucceededFuture
public final Future<Void> newSucceededFuture()
Description copied from interface:FuturePromiseFactory
Create a newFuture
which is marked as succeeded already. SoAsynchronousResult.isSuccess()
will returntrue
. AllFutureListener
added to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newSucceededFuture
in interfaceChannelOutboundInvoker
- Specified by:
newSucceededFuture
in interfaceFuturePromiseFactory
-
newSucceededFuture
public final <V> Future<V> newSucceededFuture(V value)
Description copied from interface:FuturePromiseFactory
Create a newFuture
which is marked as succeeded already. SoAsynchronousResult.isSuccess()
will returntrue
. AllFutureListener
added to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newSucceededFuture
in interfaceChannelOutboundInvoker
- Specified by:
newSucceededFuture
in interfaceFuturePromiseFactory
-
newFailedFuture
public final <V> Future<V> newFailedFuture(Throwable cause)
Description copied from interface:FuturePromiseFactory
Create a newFuture
which is marked as failed already. SoAsynchronousResult.isSuccess()
will returnfalse
. AllFutureListener
added to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newFailedFuture
in interfaceChannelOutboundInvoker
- Specified by:
newFailedFuture
in interfaceFuturePromiseFactory
-
onUnhandledInboundException
protected void onUnhandledInboundException(Throwable cause)
Called once aThrowable
hit the end of theChannelPipeline
without been handled by the user inChannelHandler.channelExceptionCaught(ChannelHandlerContext, Throwable)
.
-
onUnhandledInboundChannelActive
protected void onUnhandledInboundChannelActive()
Called once theChannelHandler.channelActive(ChannelHandlerContext)
event hit the end of theChannelPipeline
.
-
onUnhandledInboundChannelInactive
protected void onUnhandledInboundChannelInactive()
Called once theChannelHandler.channelInactive(ChannelHandlerContext)
event hit the end of theChannelPipeline
.
-
onUnhandledInboundChannelShutdown
protected void onUnhandledInboundChannelShutdown(ChannelShutdownDirection direction)
Called once theChannelHandler.channelShutdown(ChannelHandlerContext, ChannelShutdownDirection)
event hit the end of theChannelPipeline
.
-
onUnhandledInboundMessage
protected void onUnhandledInboundMessage(ChannelHandlerContext ctx, Object msg)
Called once a message hit the end of theChannelPipeline
without been handled by the user inChannelHandler.channelRead(ChannelHandlerContext, Object)
. This method is responsible to callResource.dispose(Object)
on the given msg at some point.
-
onUnhandledInboundChannelReadComplete
protected void onUnhandledInboundChannelReadComplete()
Called once theChannelHandler.channelReadComplete(ChannelHandlerContext)
event hit the end of theChannelPipeline
.
-
onUnhandledChannelInboundEvent
protected void onUnhandledChannelInboundEvent(Object evt)
Called once an user event hit the end of theChannelPipeline
without been handled by the user inChannelHandler.channelInboundEvent(ChannelHandlerContext, Object)
. This method is responsible to callResource.dispose(Object)
on the given event at some point.
-
onUnhandledChannelWritabilityChanged
protected void onUnhandledChannelWritabilityChanged()
Called once theChannelHandler.channelWritabilityChanged(ChannelHandlerContext)
event hit the end of theChannelPipeline
.
-
pendingOutboundBytesUpdated
protected abstract void pendingOutboundBytesUpdated(long pendingOutboundBytes)
Called once thependingOutboundBytes()
were changed.- Parameters:
pendingOutboundBytes
- the newpendingOutboundBytes()
.
-
pendingOutboundBytes
public final long pendingOutboundBytes()
Description copied from interface:ChannelPipeline
The number of the outbound bytes that are buffered / queued in thisChannelPipeline
. This number will affect the writability of theChannel
together the buffered / queued bytes in theChannel
itself.- Specified by:
pendingOutboundBytes
in interfaceChannelPipeline
- Returns:
- the number of buffered / queued bytes.
-
transportExecutor
protected abstract EventExecutor transportExecutor()
Returns theEventExecutor
that is used for all the abstract transport operations.- Returns:
- executor.
-
registerTransport
protected abstract void registerTransport(Promise<Void> promise)
Register the transport and notify thePromise
once the operation was completed. This method is guaranteed to be called from thetransportExecutor()
.
-
bindTransport
protected abstract void bindTransport(SocketAddress localAddress, Promise<Void> promise)
Bind theSocketAddress
to the transport and notify thePromise
once the operation was completed. This method is guaranteed to be called from thetransportExecutor()
.
-
connectTransport
protected abstract void connectTransport(SocketAddress remoteAddress, SocketAddress localAddress, Promise<Void> promise)
Connect the transport with the given remoteSocketAddress
. If a specific localSocketAddress
should be used it needs to be given as argument. Otherwise just passnull
to it. ThePromise
will get notified once the operation was completed. This method is guaranteed to be called from thetransportExecutor()
.
-
disconnectTransport
protected abstract void disconnectTransport(Promise<Void> promise)
Disconnect the transport and notify thePromise
once the operation was completed. This method is guaranteed to be called from thetransportExecutor()
.
-
closeTransport
protected abstract void closeTransport(Promise<Void> promise)
Close the transport and notify thePromise
once the operation was completed. This method is guaranteed to be called from thetransportExecutor()
.
-
shutdownTransport
protected abstract void shutdownTransport(ChannelShutdownDirection direction, Promise<Void> promise)
Shutdown the given direction of the transport and notify thePromise
once the operation was completed. This method is guaranteed to be called from thetransportExecutor()
.
-
deregisterTransport
protected abstract void deregisterTransport(Promise<Void> promise)
Deregister the transport of theEventLoop
and notify thePromise
once the operation was completed. This method is guaranteed to be called from thetransportExecutor()
.
-
readTransport
protected abstract void readTransport()
Schedules a read operation on the transport that fills the inbound buffer of the firstChannelHandler
in theChannelPipeline
. If there's already a pending read operation, this method does nothing. This method is guaranteed to be called from thetransportExecutor()
.
-
writeTransport
protected abstract void writeTransport(Object msg, Promise<Void> promise)
Schedules a write operation on the transport. The givenPromise
will be notified once the write was either successful or failed. This method is guaranteed to be called from thetransportExecutor()
.
-
flushTransport
protected abstract void flushTransport()
Flush out all (previous) scheduled write operations, scheduled viawriteTransport(Object, Promise)
. This method is guaranteed to be called from thetransportExecutor()
.
-
sendOutboundEventTransport
protected abstract void sendOutboundEventTransport(Object event, Promise<Void> promise)
Send a custom outbound event on the transport. This method is guaranteed to be called from thetransportExecutor()
.
-
-