Class DefaultChannelPipeline
- java.lang.Object
-
- io.netty.channel.DefaultChannelPipeline
-
- All Implemented Interfaces:
ChannelInboundInvoker
,ChannelOutboundInvoker
,ChannelPipeline
,java.lang.Iterable<java.util.Map.Entry<java.lang.String,ChannelHandler>>
public class DefaultChannelPipeline extends java.lang.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 Concrete Methods Modifier and Type Method Description ChannelPipeline
addAfter(EventExecutorGroup group, java.lang.String baseName, java.lang.String name, ChannelHandler handler)
Inserts aChannelHandler
after an existing handler of this pipeline.ChannelPipeline
addAfter(java.lang.String baseName, java.lang.String name, ChannelHandler handler)
Inserts aChannelHandler
after an existing handler of this pipeline.ChannelPipeline
addBefore(EventExecutorGroup group, java.lang.String baseName, java.lang.String name, ChannelHandler handler)
Inserts aChannelHandler
before an existing handler of this pipeline.ChannelPipeline
addBefore(java.lang.String baseName, java.lang.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(EventExecutorGroup executor, ChannelHandler... handlers)
InsertsChannelHandler
s at the first position of this pipeline.ChannelPipeline
addFirst(EventExecutorGroup group, java.lang.String name, ChannelHandler handler)
Inserts aChannelHandler
at the first position of this pipeline.ChannelPipeline
addFirst(java.lang.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(EventExecutorGroup executor, ChannelHandler... handlers)
InsertsChannelHandler
s at the last position of this pipeline.ChannelPipeline
addLast(EventExecutorGroup group, java.lang.String name, ChannelHandler handler)
Appends aChannelHandler
at the last position of this pipeline.ChannelPipeline
addLast(java.lang.String name, ChannelHandler handler)
Appends aChannelHandler
at the last position of this pipeline.ChannelFuture
bind(java.net.SocketAddress localAddress)
Request to bind to the givenSocketAddress
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture
bind(java.net.SocketAddress localAddress, ChannelPromise promise)
Request to bind to the givenSocketAddress
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.Channel
channel()
Returns theChannel
that this pipeline is attached to.ChannelFuture
close()
Request to close theChannel
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture
close(ChannelPromise promise)
Request to close theChannel
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture
connect(java.net.SocketAddress remoteAddress)
Request to connect to the givenSocketAddress
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture
connect(java.net.SocketAddress remoteAddress, ChannelPromise promise)
Request to connect to the givenSocketAddress
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture
connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)
Request to connect to the givenSocketAddress
while bind to the localAddress and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture
connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)
Request to connect to the givenSocketAddress
while bind to the localAddress and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelHandlerContext
context(ChannelHandler handler)
Returns the context object of the specifiedChannelHandler
in this pipeline.ChannelHandlerContext
context(java.lang.Class<? extends ChannelHandler> handlerType)
Returns the context object of theChannelHandler
of the specified type in this pipeline.ChannelHandlerContext
context(java.lang.String name)
Returns the context object of theChannelHandler
with the specified name in this pipeline.protected void
decrementPendingOutboundBytes(long size)
ChannelFuture
deregister()
Request to deregister from the previous assignedEventExecutor
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture
deregister(ChannelPromise promise)
Request to deregister from the previous assignedEventExecutor
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture
disconnect()
Request to disconnect from the remote peer and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture
disconnect(ChannelPromise promise)
Request to disconnect from the remote peer and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelPipeline
fireChannelActive()
AChannel
is active now, which means it is connected.ChannelPipeline
fireChannelInactive()
AChannel
is inactive now, which means it is closed.ChannelPipeline
fireChannelRead(java.lang.Object msg)
AChannel
received a message.ChannelPipeline
fireChannelReadComplete()
Triggers anChannelInboundHandler.channelReadComplete(ChannelHandlerContext)
event to the nextChannelInboundHandler
in theChannelPipeline
.ChannelPipeline
fireChannelRegistered()
ChannelPipeline
fireChannelUnregistered()
ChannelPipeline
fireChannelWritabilityChanged()
Triggers anChannelInboundHandler.channelWritabilityChanged(ChannelHandlerContext)
event to the nextChannelInboundHandler
in theChannelPipeline
.ChannelPipeline
fireExceptionCaught(java.lang.Throwable cause)
AChannel
received anThrowable
in one of its inbound operations.ChannelPipeline
fireUserEventTriggered(java.lang.Object event)
AChannel
received an user defined event.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.<T extends ChannelHandler>
Tget(java.lang.Class<T> handlerType)
Returns theChannelHandler
of the specified type in this pipeline.ChannelHandler
get(java.lang.String name)
Returns theChannelHandler
with the specified name in this pipeline.protected void
incrementPendingOutboundBytes(long size)
java.util.Iterator<java.util.Map.Entry<java.lang.String,ChannelHandler>>
iterator()
ChannelHandler
last()
Returns the lastChannelHandler
in this pipeline.ChannelHandlerContext
lastContext()
Returns the context of the lastChannelHandler
in this pipeline.java.util.List<java.lang.String>
names()
Returns theList
of the handler names.ChannelFuture
newFailedFuture(java.lang.Throwable cause)
Create a newChannelFuture
which is marked as failed already.ChannelProgressivePromise
newProgressivePromise()
Return an newChannelProgressivePromise
ChannelPromise
newPromise()
Return a newChannelPromise
.ChannelFuture
newSucceededFuture()
Create a newChannelFuture
which is marked as succeeded already.protected void
onUnhandledChannelWritabilityChanged()
Called once theChannelInboundHandler.channelWritabilityChanged(ChannelHandlerContext)
event hit the end of theChannelPipeline
.protected void
onUnhandledInboundChannelActive()
Called once theChannelInboundHandler.channelActive(ChannelHandlerContext)
event hit the end of theChannelPipeline
.protected void
onUnhandledInboundChannelInactive()
Called once theChannelInboundHandler.channelInactive(ChannelHandlerContext)
event hit the end of theChannelPipeline
.protected void
onUnhandledInboundChannelReadComplete()
Called once theChannelInboundHandler.channelReadComplete(ChannelHandlerContext)
event hit the end of theChannelPipeline
.protected void
onUnhandledInboundException(java.lang.Throwable cause)
Called once aThrowable
hit the end of theChannelPipeline
without been handled by the user inChannelHandler.exceptionCaught(ChannelHandlerContext, Throwable)
.protected void
onUnhandledInboundMessage(ChannelHandlerContext ctx, java.lang.Object msg)
Called once a message hit the end of theChannelPipeline
without been handled by the user inChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
.protected void
onUnhandledInboundMessage(java.lang.Object msg)
Called once a message hit the end of theChannelPipeline
without been handled by the user inChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
.protected void
onUnhandledInboundUserEventTriggered(java.lang.Object evt)
Called once an user event hit the end of theChannelPipeline
without been handled by the user inChannelInboundHandler.userEventTriggered(ChannelHandlerContext, Object)
.ChannelPipeline
read()
Request to Read data from theChannel
into the first inbound buffer, triggers anChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
event if data was read, and triggers achannelReadComplete
event so the handler can decide to continue reading.ChannelPipeline
remove(ChannelHandler handler)
Removes the specifiedChannelHandler
from this pipeline.<T extends ChannelHandler>
Tremove(java.lang.Class<T> handlerType)
Removes theChannelHandler
of the specified type from this pipeline.ChannelHandler
remove(java.lang.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)
<T extends ChannelHandler>
TremoveIfExists(java.lang.Class<T> handlerType)
<T extends ChannelHandler>
TremoveIfExists(java.lang.String name)
ChannelHandler
removeLast()
Removes the lastChannelHandler
in this pipeline.ChannelPipeline
replace(ChannelHandler oldHandler, java.lang.String newName, ChannelHandler newHandler)
Replaces the specifiedChannelHandler
with a new handler in this pipeline.<T extends ChannelHandler>
Treplace(java.lang.Class<T> oldHandlerType, java.lang.String newName, ChannelHandler newHandler)
Replaces theChannelHandler
of the specified type with a new handler in this pipeline.ChannelHandler
replace(java.lang.String oldName, java.lang.String newName, ChannelHandler newHandler)
Replaces theChannelHandler
of the specified name with a new handler in this pipeline.java.util.Map<java.lang.String,ChannelHandler>
toMap()
Converts this pipeline into an orderedMap
whose keys are handler names and whose values are handlers.java.lang.String
toString()
Returns theString
representation of this pipeline.ChannelPromise
voidPromise()
Return a special ChannelPromise which can be reused for different operations.ChannelFuture
write(java.lang.Object msg)
Request to write a message via thisChannelHandlerContext
through theChannelPipeline
.ChannelFuture
write(java.lang.Object msg, ChannelPromise promise)
Request to write a message via thisChannelHandlerContext
through theChannelPipeline
.ChannelFuture
writeAndFlush(java.lang.Object msg)
Shortcut for callChannelOutboundInvoker.write(Object)
andChannelOutboundInvoker.flush()
.ChannelFuture
writeAndFlush(java.lang.Object msg, ChannelPromise promise)
Shortcut for callChannelOutboundInvoker.write(Object, ChannelPromise)
andChannelOutboundInvoker.flush()
.
-
-
-
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.
-
addFirst
public final ChannelPipeline addFirst(java.lang.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
-
addFirst
public final ChannelPipeline addFirst(EventExecutorGroup group, java.lang.String name, ChannelHandler handler)
Description copied from interface:ChannelPipeline
Inserts aChannelHandler
at the first position of this pipeline.- Specified by:
addFirst
in interfaceChannelPipeline
- Parameters:
group
- theEventExecutorGroup
which will be used to execute theChannelHandler
methodsname
- the name of the handler to insert firsthandler
- the handler to insert first
-
addLast
public final ChannelPipeline addLast(java.lang.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
-
addLast
public final ChannelPipeline addLast(EventExecutorGroup group, java.lang.String name, ChannelHandler handler)
Description copied from interface:ChannelPipeline
Appends aChannelHandler
at the last position of this pipeline.- Specified by:
addLast
in interfaceChannelPipeline
- Parameters:
group
- theEventExecutorGroup
which will be used to execute theChannelHandler
methodsname
- the name of the handler to appendhandler
- the handler to append
-
addBefore
public final ChannelPipeline addBefore(java.lang.String baseName, java.lang.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
-
addBefore
public final ChannelPipeline addBefore(EventExecutorGroup group, java.lang.String baseName, java.lang.String name, ChannelHandler handler)
Description copied from interface:ChannelPipeline
Inserts aChannelHandler
before an existing handler of this pipeline.- Specified by:
addBefore
in interfaceChannelPipeline
- Parameters:
group
- theEventExecutorGroup
which will be used to execute theChannelHandler
methodsbaseName
- the name of the existing handlername
- the name of the handler to insert beforehandler
- the handler to insert before
-
addAfter
public final ChannelPipeline addAfter(java.lang.String baseName, java.lang.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
-
addAfter
public final ChannelPipeline addAfter(EventExecutorGroup group, java.lang.String baseName, java.lang.String name, ChannelHandler handler)
Description copied from interface:ChannelPipeline
Inserts aChannelHandler
after an existing handler of this pipeline.- Specified by:
addAfter
in interfaceChannelPipeline
- Parameters:
group
- theEventExecutorGroup
which will be used to execute theChannelHandler
methodsbaseName
- 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.- Specified by:
addFirst
in interfaceChannelPipeline
- Parameters:
handlers
- the handlers to insert first
-
addFirst
public final ChannelPipeline addFirst(EventExecutorGroup executor, ChannelHandler... handlers)
Description copied from interface:ChannelPipeline
InsertsChannelHandler
s at the first position of this pipeline.- Specified by:
addFirst
in interfaceChannelPipeline
- Parameters:
executor
- theEventExecutorGroup
which will be used to execute theChannelHandler
s methods.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.- Specified by:
addLast
in interfaceChannelPipeline
- Parameters:
handlers
- the handlers to insert last
-
addLast
public final ChannelPipeline addLast(EventExecutorGroup executor, ChannelHandler... handlers)
Description copied from interface:ChannelPipeline
InsertsChannelHandler
s at the last position of this pipeline.- Specified by:
addLast
in interfaceChannelPipeline
- Parameters:
executor
- theEventExecutorGroup
which will be used to execute theChannelHandler
s methods.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(java.lang.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(java.lang.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(java.lang.String name)
-
removeIfExists
public final <T extends ChannelHandler> T removeIfExists(java.lang.Class<T> handlerType)
-
removeIfExists
public final <T extends ChannelHandler> T removeIfExists(ChannelHandler handler)
-
removeFirst
public final ChannelHandler removeFirst()
Description copied from interface:ChannelPipeline
Removes the firstChannelHandler
in this pipeline.- Specified by:
removeFirst
in interfaceChannelPipeline
- Returns:
- the removed handler
-
removeLast
public final ChannelHandler removeLast()
Description copied from interface:ChannelPipeline
Removes the lastChannelHandler
in this pipeline.- Specified by:
removeLast
in interfaceChannelPipeline
- Returns:
- the removed handler
-
replace
public final ChannelPipeline replace(ChannelHandler oldHandler, java.lang.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(java.lang.String oldName, java.lang.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(java.lang.Class<T> oldHandlerType, java.lang.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
-
first
public final 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 final 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 final 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 final 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.
-
get
public final ChannelHandler get(java.lang.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(java.lang.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(java.lang.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(java.lang.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 java.util.List<java.lang.String> names()
Description copied from interface:ChannelPipeline
Returns theList
of the handler names.- Specified by:
names
in interfaceChannelPipeline
-
toMap
public final java.util.Map<java.lang.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 final java.util.Iterator<java.util.Map.Entry<java.lang.String,ChannelHandler>> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<java.util.Map.Entry<java.lang.String,ChannelHandler>>
-
toString
public final java.lang.String toString()
Returns theString
representation of this pipeline.- Overrides:
toString
in classjava.lang.Object
-
fireChannelRegistered
public final ChannelPipeline fireChannelRegistered()
Description copied from interface:ChannelInboundInvoker
AChannel
was registered to itsEventLoop
. This will result in having theChannelInboundHandler.channelRegistered(ChannelHandlerContext)
method called of the nextChannelInboundHandler
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 theChannelInboundHandler.channelUnregistered(ChannelHandlerContext)
method called of the nextChannelInboundHandler
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 theChannelInboundHandler.channelActive(ChannelHandlerContext)
method called of the nextChannelInboundHandler
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 theChannelInboundHandler.channelInactive(ChannelHandlerContext)
method called of the nextChannelInboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
fireChannelInactive
in interfaceChannelInboundInvoker
- Specified by:
fireChannelInactive
in interfaceChannelPipeline
-
fireExceptionCaught
public final ChannelPipeline fireExceptionCaught(java.lang.Throwable cause)
Description copied from interface:ChannelInboundInvoker
AChannel
received anThrowable
in one of its inbound operations. This will result in having theChannelInboundHandler.exceptionCaught(ChannelHandlerContext, Throwable)
method called of the nextChannelInboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
fireExceptionCaught
in interfaceChannelInboundInvoker
- Specified by:
fireExceptionCaught
in interfaceChannelPipeline
-
fireUserEventTriggered
public final ChannelPipeline fireUserEventTriggered(java.lang.Object event)
Description copied from interface:ChannelInboundInvoker
AChannel
received an user defined event. This will result in having theChannelInboundHandler.userEventTriggered(ChannelHandlerContext, Object)
method called of the nextChannelInboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
fireUserEventTriggered
in interfaceChannelInboundInvoker
- Specified by:
fireUserEventTriggered
in interfaceChannelPipeline
-
fireChannelRead
public final ChannelPipeline fireChannelRead(java.lang.Object msg)
Description copied from interface:ChannelInboundInvoker
AChannel
received a message. This will result in having theChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
method called of the nextChannelInboundHandler
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 anChannelInboundHandler.channelReadComplete(ChannelHandlerContext)
event to the nextChannelInboundHandler
in theChannelPipeline
.- Specified by:
fireChannelReadComplete
in interfaceChannelInboundInvoker
- Specified by:
fireChannelReadComplete
in interfaceChannelPipeline
-
fireChannelWritabilityChanged
public final ChannelPipeline fireChannelWritabilityChanged()
Description copied from interface:ChannelInboundInvoker
Triggers anChannelInboundHandler.channelWritabilityChanged(ChannelHandlerContext)
event to the nextChannelInboundHandler
in theChannelPipeline
.- Specified by:
fireChannelWritabilityChanged
in interfaceChannelInboundInvoker
- Specified by:
fireChannelWritabilityChanged
in interfaceChannelPipeline
-
bind
public final ChannelFuture bind(java.net.SocketAddress localAddress)
Description copied from interface:ChannelOutboundInvoker
Request to bind to the givenSocketAddress
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelOutboundHandler.bind(ChannelHandlerContext, SocketAddress, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
bind
in interfaceChannelOutboundInvoker
-
connect
public final ChannelFuture connect(java.net.SocketAddress remoteAddress)
Description copied from interface:ChannelOutboundInvoker
Request to connect to the givenSocketAddress
and notify theChannelFuture
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
ChannelFuture
will get failed with aConnectTimeoutException
. If it fails because of connection refused aConnectException
will be used.This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
connect
in interfaceChannelOutboundInvoker
-
connect
public final ChannelFuture connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)
Description copied from interface:ChannelOutboundInvoker
Request to connect to the givenSocketAddress
while bind to the localAddress and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
connect
in interfaceChannelOutboundInvoker
-
disconnect
public final ChannelFuture disconnect()
Description copied from interface:ChannelOutboundInvoker
Request to disconnect from the remote peer and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelOutboundHandler.disconnect(ChannelHandlerContext, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
disconnect
in interfaceChannelOutboundInvoker
-
close
public final ChannelFuture close()
Description copied from interface:ChannelOutboundInvoker
Request to close theChannel
and notify theChannelFuture
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
ChannelOutboundHandler.close(ChannelHandlerContext, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
close
in interfaceChannelOutboundInvoker
-
deregister
public final ChannelFuture deregister()
Description copied from interface:ChannelOutboundInvoker
Request to deregister from the previous assignedEventExecutor
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelOutboundHandler.deregister(ChannelHandlerContext, ChannelPromise)
method called of the nextChannelOutboundHandler
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
-
bind
public final ChannelFuture bind(java.net.SocketAddress localAddress, ChannelPromise promise)
Description copied from interface:ChannelOutboundInvoker
Request to bind to the givenSocketAddress
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error. The givenChannelPromise
will be notified.This will result in having the
ChannelOutboundHandler.bind(ChannelHandlerContext, SocketAddress, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
bind
in interfaceChannelOutboundInvoker
-
connect
public final ChannelFuture connect(java.net.SocketAddress remoteAddress, ChannelPromise promise)
Description copied from interface:ChannelOutboundInvoker
Request to connect to the givenSocketAddress
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error. The givenChannelFuture
will be notified.If the connection fails because of a connection timeout, the
ChannelFuture
will get failed with aConnectTimeoutException
. If it fails because of connection refused aConnectException
will be used.This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
connect
in interfaceChannelOutboundInvoker
-
connect
public final ChannelFuture connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)
Description copied from interface:ChannelOutboundInvoker
Request to connect to the givenSocketAddress
while bind to the localAddress and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error. The givenChannelPromise
will be notified and also returned.This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
connect
in interfaceChannelOutboundInvoker
-
disconnect
public final ChannelFuture disconnect(ChannelPromise promise)
Description copied from interface:ChannelOutboundInvoker
Request to disconnect from the remote peer and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error. The givenChannelPromise
will be notified.This will result in having the
ChannelOutboundHandler.disconnect(ChannelHandlerContext, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
disconnect
in interfaceChannelOutboundInvoker
-
close
public final ChannelFuture close(ChannelPromise promise)
Description copied from interface:ChannelOutboundInvoker
Request to close theChannel
and notify theChannelFuture
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. The givenChannelPromise
will be notified.This will result in having the
ChannelOutboundHandler.close(ChannelHandlerContext, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
close
in interfaceChannelOutboundInvoker
-
deregister
public final ChannelFuture deregister(ChannelPromise promise)
Description copied from interface:ChannelOutboundInvoker
Request to deregister from the previous assignedEventExecutor
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error. The givenChannelPromise
will be notified.This will result in having the
ChannelOutboundHandler.deregister(ChannelHandlerContext, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
deregister
in interfaceChannelOutboundInvoker
-
read
public final ChannelPipeline read()
Description copied from interface:ChannelOutboundInvoker
Request to Read data from theChannel
into the first inbound buffer, triggers anChannelInboundHandler.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
ChannelOutboundHandler.read(ChannelHandlerContext)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
read
in interfaceChannelOutboundInvoker
-
write
public final ChannelFuture write(java.lang.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
-
write
public final ChannelFuture write(java.lang.Object msg, ChannelPromise promise)
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 ChannelFuture writeAndFlush(java.lang.Object msg, ChannelPromise promise)
Description copied from interface:ChannelOutboundInvoker
Shortcut for callChannelOutboundInvoker.write(Object, ChannelPromise)
andChannelOutboundInvoker.flush()
.- Specified by:
writeAndFlush
in interfaceChannelOutboundInvoker
-
writeAndFlush
public final ChannelFuture writeAndFlush(java.lang.Object msg)
Description copied from interface:ChannelOutboundInvoker
Shortcut for callChannelOutboundInvoker.write(Object)
andChannelOutboundInvoker.flush()
.- Specified by:
writeAndFlush
in interfaceChannelOutboundInvoker
-
newPromise
public final ChannelPromise newPromise()
Description copied from interface:ChannelOutboundInvoker
Return a newChannelPromise
.- Specified by:
newPromise
in interfaceChannelOutboundInvoker
- Specified by:
newPromise
in interfaceChannelPipeline
-
newProgressivePromise
public final ChannelProgressivePromise newProgressivePromise()
Description copied from interface:ChannelOutboundInvoker
Return an newChannelProgressivePromise
- Specified by:
newProgressivePromise
in interfaceChannelOutboundInvoker
- Specified by:
newProgressivePromise
in interfaceChannelPipeline
-
newSucceededFuture
public final ChannelFuture newSucceededFuture()
Description copied from interface:ChannelOutboundInvoker
Create a newChannelFuture
which is marked as succeeded already. SoFuture.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
-
newFailedFuture
public final ChannelFuture newFailedFuture(java.lang.Throwable cause)
Description copied from interface:ChannelOutboundInvoker
Create a newChannelFuture
which is marked as failed already. SoFuture.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 interfaceChannelPipeline
-
voidPromise
public final ChannelPromise voidPromise()
Description copied from interface:ChannelOutboundInvoker
Return a special ChannelPromise which can be reused for different operations.It's only supported to use it for
ChannelOutboundInvoker.write(Object, ChannelPromise)
.Be aware that the returned
Be aware this is an expert feature and should be used with care!ChannelPromise
will not support most operations and should only be used if you want to save an object allocation for every write operation. You will not be able to detect if the operation was complete, only if it failed as the implementation will callChannelPipeline.fireExceptionCaught(Throwable)
in this case.- Specified by:
voidPromise
in interfaceChannelOutboundInvoker
-
onUnhandledInboundException
protected void onUnhandledInboundException(java.lang.Throwable cause)
Called once aThrowable
hit the end of theChannelPipeline
without been handled by the user inChannelHandler.exceptionCaught(ChannelHandlerContext, Throwable)
.
-
onUnhandledInboundChannelActive
protected void onUnhandledInboundChannelActive()
Called once theChannelInboundHandler.channelActive(ChannelHandlerContext)
event hit the end of theChannelPipeline
.
-
onUnhandledInboundChannelInactive
protected void onUnhandledInboundChannelInactive()
Called once theChannelInboundHandler.channelInactive(ChannelHandlerContext)
event hit the end of theChannelPipeline
.
-
onUnhandledInboundMessage
protected void onUnhandledInboundMessage(java.lang.Object msg)
Called once a message hit the end of theChannelPipeline
without been handled by the user inChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
. This method is responsible to callReferenceCountUtil.release(Object)
on the given msg at some point.
-
onUnhandledInboundMessage
protected void onUnhandledInboundMessage(ChannelHandlerContext ctx, java.lang.Object msg)
Called once a message hit the end of theChannelPipeline
without been handled by the user inChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
. This method is responsible to callReferenceCountUtil.release(Object)
on the given msg at some point.
-
onUnhandledInboundChannelReadComplete
protected void onUnhandledInboundChannelReadComplete()
Called once theChannelInboundHandler.channelReadComplete(ChannelHandlerContext)
event hit the end of theChannelPipeline
.
-
onUnhandledInboundUserEventTriggered
protected void onUnhandledInboundUserEventTriggered(java.lang.Object evt)
Called once an user event hit the end of theChannelPipeline
without been handled by the user inChannelInboundHandler.userEventTriggered(ChannelHandlerContext, Object)
. This method is responsible to callReferenceCountUtil.release(Object)
on the given event at some point.
-
onUnhandledChannelWritabilityChanged
protected void onUnhandledChannelWritabilityChanged()
Called once theChannelInboundHandler.channelWritabilityChanged(ChannelHandlerContext)
event hit the end of theChannelPipeline
.
-
incrementPendingOutboundBytes
protected void incrementPendingOutboundBytes(long size)
-
decrementPendingOutboundBytes
protected void decrementPendingOutboundBytes(long size)
-
-