public class DefaultChannelPipeline extends Object implements ChannelPipeline
ChannelPipeline
implementation. It is usually created
by a Channel
implementation when the Channel
is created.Modifier | Constructor and Description |
---|---|
protected |
DefaultChannelPipeline(Channel channel) |
Modifier and Type | Method and Description |
---|---|
ChannelPipeline |
addAfter(EventExecutorGroup group,
String baseName,
String name,
ChannelHandler handler)
Inserts a
ChannelHandler after an existing handler of this
pipeline. |
ChannelPipeline |
addAfter(String baseName,
String name,
ChannelHandler handler)
Inserts a
ChannelHandler after an existing handler of this
pipeline. |
ChannelPipeline |
addBefore(EventExecutorGroup group,
String baseName,
String name,
ChannelHandler handler)
Inserts a
ChannelHandler before an existing handler of this
pipeline. |
ChannelPipeline |
addBefore(String baseName,
String name,
ChannelHandler handler)
Inserts a
ChannelHandler before an existing handler of this
pipeline. |
ChannelPipeline |
addFirst(ChannelHandler... handlers)
Inserts
ChannelHandler s at the first position of this pipeline. |
ChannelPipeline |
addFirst(ChannelHandler handler) |
ChannelPipeline |
addFirst(EventExecutorGroup executor,
ChannelHandler... handlers)
Inserts
ChannelHandler s at the first position of this pipeline. |
ChannelPipeline |
addFirst(EventExecutorGroup group,
String name,
ChannelHandler handler)
Inserts a
ChannelHandler at the first position of this pipeline. |
ChannelPipeline |
addFirst(String name,
ChannelHandler handler)
Inserts a
ChannelHandler at the first position of this pipeline. |
ChannelPipeline |
addLast(ChannelHandler... handlers)
Inserts
ChannelHandler s at the last position of this pipeline. |
ChannelPipeline |
addLast(ChannelHandler handler) |
ChannelPipeline |
addLast(EventExecutorGroup executor,
ChannelHandler... handlers)
Inserts
ChannelHandler s at the last position of this pipeline. |
ChannelPipeline |
addLast(EventExecutorGroup group,
String name,
ChannelHandler handler)
Appends a
ChannelHandler at the last position of this pipeline. |
ChannelPipeline |
addLast(String name,
ChannelHandler handler)
Appends a
ChannelHandler at the last position of this pipeline. |
ChannelFuture |
bind(SocketAddress localAddress)
Request to bind to the given
SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error. |
ChannelFuture |
bind(SocketAddress localAddress,
ChannelPromise promise)
Request to bind to the given
SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error. |
Channel |
channel()
Returns the
Channel that this pipeline is attached to. |
ChannelFuture |
close()
Request to close the
Channel and notify the ChannelFuture once the operation completes,
either because the operation was successful or because of
an error. |
ChannelFuture |
close(ChannelPromise promise)
Request to close the
Channel and notify the ChannelFuture once the operation completes,
either because the operation was successful or because of
an error. |
ChannelFuture |
connect(SocketAddress remoteAddress)
Request to connect to the given
SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error. |
ChannelFuture |
connect(SocketAddress remoteAddress,
ChannelPromise promise)
Request to connect to the given
SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error. |
ChannelFuture |
connect(SocketAddress remoteAddress,
SocketAddress localAddress)
Request to connect to the given
SocketAddress while bind to the localAddress and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error. |
ChannelFuture |
connect(SocketAddress remoteAddress,
SocketAddress localAddress,
ChannelPromise promise)
Request to connect to the given
SocketAddress while bind to the localAddress and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error. |
ChannelHandlerContext |
context(ChannelHandler handler)
Returns the context object of the specified
ChannelHandler in
this pipeline. |
ChannelHandlerContext |
context(Class<? extends ChannelHandler> handlerType)
Returns the context object of the
ChannelHandler of the
specified type in this pipeline. |
ChannelHandlerContext |
context(String name)
Returns the context object of the
ChannelHandler with the
specified name in this pipeline. |
protected void |
decrementPendingOutboundBytes(long size) |
ChannelFuture |
deregister()
Request to deregister from the previous assigned
EventExecutor and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error. |
ChannelFuture |
deregister(ChannelPromise promise)
Request to deregister from the previous assigned
EventExecutor and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error. |
ChannelFuture |
disconnect()
Request to disconnect from the remote peer and notify the
ChannelFuture once the operation completes,
either because the operation was successful or because of an error. |
ChannelFuture |
disconnect(ChannelPromise promise)
Request to disconnect from the remote peer and notify the
ChannelFuture once the operation completes,
either because the operation was successful or because of an error. |
ChannelPipeline |
fireChannelActive()
A
Channel is active now, which means it is connected. |
ChannelPipeline |
fireChannelInactive()
A
Channel is inactive now, which means it is closed. |
ChannelPipeline |
fireChannelRead(Object msg)
A
Channel received a message. |
ChannelPipeline |
fireChannelReadComplete()
Triggers an
ChannelInboundHandler.channelReadComplete(ChannelHandlerContext)
event to the next ChannelInboundHandler in the ChannelPipeline . |
ChannelPipeline |
fireChannelRegistered()
|
ChannelPipeline |
fireChannelUnregistered()
|
ChannelPipeline |
fireChannelWritabilityChanged()
Triggers an
ChannelInboundHandler.channelWritabilityChanged(ChannelHandlerContext)
event to the next ChannelInboundHandler in the ChannelPipeline . |
ChannelPipeline |
fireExceptionCaught(Throwable cause)
|
ChannelPipeline |
fireUserEventTriggered(Object event)
A
Channel received an user defined event. |
ChannelHandler |
first()
Returns the first
ChannelHandler in this pipeline. |
ChannelHandlerContext |
firstContext()
Returns the context of the first
ChannelHandler in this pipeline. |
ChannelPipeline |
flush()
Request to flush all pending messages via this ChannelOutboundInvoker.
|
<T extends ChannelHandler> |
get(Class<T> handlerType)
Returns the
ChannelHandler of the specified type in this
pipeline. |
ChannelHandler |
get(String name)
Returns the
ChannelHandler with the specified name in this
pipeline. |
protected void |
incrementPendingOutboundBytes(long size) |
Iterator<Map.Entry<String,ChannelHandler>> |
iterator() |
ChannelHandler |
last()
Returns the last
ChannelHandler in this pipeline. |
ChannelHandlerContext |
lastContext()
Returns the context of the last
ChannelHandler in this pipeline. |
List<String> |
names()
Returns the
List of the handler names. |
ChannelFuture |
newFailedFuture(Throwable cause)
Create a new
ChannelFuture which is marked as failed already. |
ChannelProgressivePromise |
newProgressivePromise()
Return an new
ChannelProgressivePromise |
ChannelPromise |
newPromise()
Return a new
ChannelPromise . |
ChannelFuture |
newSucceededFuture()
Create a new
ChannelFuture which is marked as succeeded already. |
protected void |
onUnhandledChannelWritabilityChanged()
Called once the
ChannelInboundHandler.channelWritabilityChanged(ChannelHandlerContext) event hit
the end of the ChannelPipeline . |
protected void |
onUnhandledInboundChannelActive()
Called once the
ChannelInboundHandler.channelActive(ChannelHandlerContext) event hit
the end of the ChannelPipeline . |
protected void |
onUnhandledInboundChannelInactive()
Called once the
ChannelInboundHandler.channelInactive(ChannelHandlerContext) event hit
the end of the ChannelPipeline . |
protected void |
onUnhandledInboundChannelReadComplete()
Called once the
ChannelInboundHandler.channelReadComplete(ChannelHandlerContext) event hit
the end of the ChannelPipeline . |
protected void |
onUnhandledInboundException(Throwable cause)
Called once a
Throwable hit the end of the ChannelPipeline without been handled by the user
in ChannelHandler.exceptionCaught(ChannelHandlerContext, Throwable) . |
protected void |
onUnhandledInboundMessage(ChannelHandlerContext ctx,
Object msg)
Called once a message hit the end of the
ChannelPipeline without been handled by the user
in ChannelInboundHandler.channelRead(ChannelHandlerContext, Object) . |
protected void |
onUnhandledInboundMessage(Object msg)
Called once a message hit the end of the
ChannelPipeline without been handled by the user
in ChannelInboundHandler.channelRead(ChannelHandlerContext, Object) . |
protected void |
onUnhandledInboundUserEventTriggered(Object evt)
Called once an user event hit the end of the
ChannelPipeline without been handled by the user
in ChannelInboundHandler.userEventTriggered(ChannelHandlerContext, Object) . |
ChannelPipeline |
read()
Request to Read data from the
Channel into the first inbound buffer, triggers an
ChannelInboundHandler.channelRead(ChannelHandlerContext, Object) event if data was
read, and triggers a
channelReadComplete event so the
handler can decide to continue reading. |
ChannelPipeline |
remove(ChannelHandler handler)
Removes the specified
ChannelHandler from this pipeline. |
<T extends ChannelHandler> |
remove(Class<T> handlerType)
Removes the
ChannelHandler of the specified type from this pipeline. |
ChannelHandler |
remove(String name)
Removes the
ChannelHandler with the specified name from this pipeline. |
ChannelHandler |
removeFirst()
Removes the first
ChannelHandler in this pipeline. |
<T extends ChannelHandler> |
removeIfExists(ChannelHandler handler) |
<T extends ChannelHandler> |
removeIfExists(Class<T> handlerType) |
<T extends ChannelHandler> |
removeIfExists(String name) |
ChannelHandler |
removeLast()
Removes the last
ChannelHandler in this pipeline. |
ChannelPipeline |
replace(ChannelHandler oldHandler,
String newName,
ChannelHandler newHandler)
Replaces the specified
ChannelHandler with a new handler in this pipeline. |
<T extends ChannelHandler> |
replace(Class<T> oldHandlerType,
String newName,
ChannelHandler newHandler)
Replaces the
ChannelHandler of the specified type with a new handler in this pipeline. |
ChannelHandler |
replace(String oldName,
String newName,
ChannelHandler newHandler)
Replaces the
ChannelHandler of the specified name with a new handler in this pipeline. |
Map<String,ChannelHandler> |
toMap()
Converts this pipeline into an ordered
Map whose keys are
handler names and whose values are handlers. |
String |
toString()
Returns the
String representation of this pipeline. |
ChannelPromise |
voidPromise()
Return a special ChannelPromise which can be reused for different operations.
|
ChannelFuture |
write(Object msg)
Request to write a message via this
ChannelHandlerContext through the ChannelPipeline . |
ChannelFuture |
write(Object msg,
ChannelPromise promise)
Request to write a message via this
ChannelHandlerContext through the ChannelPipeline . |
ChannelFuture |
writeAndFlush(Object msg)
Shortcut for call
ChannelOutboundInvoker.write(Object) and ChannelOutboundInvoker.flush() . |
ChannelFuture |
writeAndFlush(Object msg,
ChannelPromise promise)
Shortcut for call
ChannelOutboundInvoker.write(Object, ChannelPromise) and ChannelOutboundInvoker.flush() . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected DefaultChannelPipeline(Channel channel)
public final Channel channel()
ChannelPipeline
Channel
that this pipeline is attached to.channel
in interface ChannelPipeline
null
if this pipeline is not attached yet.public final ChannelPipeline addFirst(String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
at the first position of this pipeline.addFirst
in interface ChannelPipeline
name
- the name of the handler to insert firsthandler
- the handler to insert firstpublic final ChannelPipeline addFirst(EventExecutorGroup group, String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
at the first position of this pipeline.addFirst
in interface ChannelPipeline
group
- the EventExecutorGroup
which will be used to execute the ChannelHandler
methodsname
- the name of the handler to insert firsthandler
- the handler to insert firstpublic final ChannelPipeline addLast(String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
at the last position of this pipeline.addLast
in interface ChannelPipeline
name
- the name of the handler to appendhandler
- the handler to appendpublic final ChannelPipeline addLast(EventExecutorGroup group, String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
at the last position of this pipeline.addLast
in interface ChannelPipeline
group
- the EventExecutorGroup
which will be used to execute the ChannelHandler
methodsname
- the name of the handler to appendhandler
- the handler to appendpublic final ChannelPipeline addBefore(String baseName, String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
before an existing handler of this
pipeline.addBefore
in interface ChannelPipeline
baseName
- the name of the existing handlername
- the name of the handler to insert beforehandler
- the handler to insert beforepublic final ChannelPipeline addBefore(EventExecutorGroup group, String baseName, String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
before an existing handler of this
pipeline.addBefore
in interface ChannelPipeline
group
- the EventExecutorGroup
which will be used to execute the ChannelHandler
methodsbaseName
- the name of the existing handlername
- the name of the handler to insert beforehandler
- the handler to insert beforepublic final ChannelPipeline addAfter(String baseName, String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
after an existing handler of this
pipeline.addAfter
in interface ChannelPipeline
baseName
- the name of the existing handlername
- the name of the handler to insert afterhandler
- the handler to insert afterpublic final ChannelPipeline addAfter(EventExecutorGroup group, String baseName, String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
after an existing handler of this
pipeline.addAfter
in interface ChannelPipeline
group
- the EventExecutorGroup
which will be used to execute the ChannelHandler
methodsbaseName
- the name of the existing handlername
- the name of the handler to insert afterhandler
- the handler to insert afterpublic final ChannelPipeline addFirst(ChannelHandler handler)
public final ChannelPipeline addFirst(ChannelHandler... handlers)
ChannelPipeline
ChannelHandler
s at the first position of this pipeline.addFirst
in interface ChannelPipeline
handlers
- the handlers to insert firstpublic final ChannelPipeline addFirst(EventExecutorGroup executor, ChannelHandler... handlers)
ChannelPipeline
ChannelHandler
s at the first position of this pipeline.addFirst
in interface ChannelPipeline
executor
- the EventExecutorGroup
which will be used to execute the ChannelHandler
s
methods.handlers
- the handlers to insert firstpublic final ChannelPipeline addLast(ChannelHandler handler)
public final ChannelPipeline addLast(ChannelHandler... handlers)
ChannelPipeline
ChannelHandler
s at the last position of this pipeline.addLast
in interface ChannelPipeline
handlers
- the handlers to insert lastpublic final ChannelPipeline addLast(EventExecutorGroup executor, ChannelHandler... handlers)
ChannelPipeline
ChannelHandler
s at the last position of this pipeline.addLast
in interface ChannelPipeline
executor
- the EventExecutorGroup
which will be used to execute the ChannelHandler
s
methods.handlers
- the handlers to insert lastpublic final ChannelPipeline remove(ChannelHandler handler)
ChannelPipeline
ChannelHandler
from this pipeline.remove
in interface ChannelPipeline
handler
- the ChannelHandler
to removepublic final ChannelHandler remove(String name)
ChannelPipeline
ChannelHandler
with the specified name from this pipeline.remove
in interface ChannelPipeline
name
- the name under which the ChannelHandler
was stored.public final <T extends ChannelHandler> T remove(Class<T> handlerType)
ChannelPipeline
ChannelHandler
of the specified type from this pipeline.remove
in interface ChannelPipeline
T
- the type of the handlerhandlerType
- the type of the handlerpublic final <T extends ChannelHandler> T removeIfExists(String name)
public final <T extends ChannelHandler> T removeIfExists(Class<T> handlerType)
public final <T extends ChannelHandler> T removeIfExists(ChannelHandler handler)
public final ChannelHandler removeFirst()
ChannelPipeline
ChannelHandler
in this pipeline.removeFirst
in interface ChannelPipeline
public final ChannelHandler removeLast()
ChannelPipeline
ChannelHandler
in this pipeline.removeLast
in interface ChannelPipeline
public final ChannelPipeline replace(ChannelHandler oldHandler, String newName, ChannelHandler newHandler)
ChannelPipeline
ChannelHandler
with a new handler in this pipeline.replace
in interface ChannelPipeline
oldHandler
- the ChannelHandler
to be replacednewName
- the name under which the replacement should be addednewHandler
- the ChannelHandler
which is used as replacementpublic final ChannelHandler replace(String oldName, String newName, ChannelHandler newHandler)
ChannelPipeline
ChannelHandler
of the specified name with a new handler in this pipeline.replace
in interface ChannelPipeline
oldName
- the name of the ChannelHandler
to be replacednewName
- the name under which the replacement should be addednewHandler
- the ChannelHandler
which is used as replacementpublic final <T extends ChannelHandler> T replace(Class<T> oldHandlerType, String newName, ChannelHandler newHandler)
ChannelPipeline
ChannelHandler
of the specified type with a new handler in this pipeline.replace
in interface ChannelPipeline
oldHandlerType
- the type of the handler to be removednewName
- the name under which the replacement should be addednewHandler
- the ChannelHandler
which is used as replacementpublic final ChannelHandler first()
ChannelPipeline
ChannelHandler
in this pipeline.first
in interface ChannelPipeline
null
if this pipeline is empty.public final ChannelHandlerContext firstContext()
ChannelPipeline
ChannelHandler
in this pipeline.firstContext
in interface ChannelPipeline
null
if this pipeline is empty.public final ChannelHandler last()
ChannelPipeline
ChannelHandler
in this pipeline.last
in interface ChannelPipeline
null
if this pipeline is empty.public final ChannelHandlerContext lastContext()
ChannelPipeline
ChannelHandler
in this pipeline.lastContext
in interface ChannelPipeline
null
if this pipeline is empty.public final ChannelHandler get(String name)
ChannelPipeline
ChannelHandler
with the specified name in this
pipeline.get
in interface ChannelPipeline
null
if there's no such handler in this pipeline.public final <T extends ChannelHandler> T get(Class<T> handlerType)
ChannelPipeline
ChannelHandler
of the specified type in this
pipeline.get
in interface ChannelPipeline
null
if there's no such handler in this pipeline.public final ChannelHandlerContext context(String name)
ChannelPipeline
ChannelHandler
with the
specified name in this pipeline.context
in interface ChannelPipeline
null
if there's no such handler in this pipeline.public final ChannelHandlerContext context(ChannelHandler handler)
ChannelPipeline
ChannelHandler
in
this pipeline.context
in interface ChannelPipeline
null
if there's no such handler in this pipeline.public final ChannelHandlerContext context(Class<? extends ChannelHandler> handlerType)
ChannelPipeline
ChannelHandler
of the
specified type in this pipeline.context
in interface ChannelPipeline
null
if there's no such handler in this pipeline.public final List<String> names()
ChannelPipeline
List
of the handler names.names
in interface ChannelPipeline
public final Map<String,ChannelHandler> toMap()
ChannelPipeline
Map
whose keys are
handler names and whose values are handlers.toMap
in interface ChannelPipeline
public final Iterator<Map.Entry<String,ChannelHandler>> iterator()
iterator
in interface Iterable<Map.Entry<String,ChannelHandler>>
public final ChannelPipeline fireChannelRegistered()
ChannelInboundInvoker
Channel
was registered to its EventLoop
.
This will result in having the ChannelInboundHandler.channelRegistered(ChannelHandlerContext)
method
called of the next ChannelInboundHandler
contained in the ChannelPipeline
of the
Channel
.fireChannelRegistered
in interface ChannelInboundInvoker
fireChannelRegistered
in interface ChannelPipeline
public final ChannelPipeline fireChannelUnregistered()
ChannelInboundInvoker
Channel
was unregistered from its EventLoop
.
This will result in having the ChannelInboundHandler.channelUnregistered(ChannelHandlerContext)
method
called of the next ChannelInboundHandler
contained in the ChannelPipeline
of the
Channel
.fireChannelUnregistered
in interface ChannelInboundInvoker
fireChannelUnregistered
in interface ChannelPipeline
public final ChannelPipeline fireChannelActive()
ChannelInboundInvoker
Channel
is active now, which means it is connected.
This will result in having the ChannelInboundHandler.channelActive(ChannelHandlerContext)
method
called of the next ChannelInboundHandler
contained in the ChannelPipeline
of the
Channel
.fireChannelActive
in interface ChannelInboundInvoker
fireChannelActive
in interface ChannelPipeline
public final ChannelPipeline fireChannelInactive()
ChannelInboundInvoker
Channel
is inactive now, which means it is closed.
This will result in having the ChannelInboundHandler.channelInactive(ChannelHandlerContext)
method
called of the next ChannelInboundHandler
contained in the ChannelPipeline
of the
Channel
.fireChannelInactive
in interface ChannelInboundInvoker
fireChannelInactive
in interface ChannelPipeline
public final ChannelPipeline fireExceptionCaught(Throwable cause)
ChannelInboundInvoker
Channel
received an Throwable
in one of its inbound operations.
This will result in having the ChannelInboundHandler.exceptionCaught(ChannelHandlerContext, Throwable)
method called of the next ChannelInboundHandler
contained in the ChannelPipeline
of the
Channel
.fireExceptionCaught
in interface ChannelInboundInvoker
fireExceptionCaught
in interface ChannelPipeline
public final ChannelPipeline fireUserEventTriggered(Object event)
ChannelInboundInvoker
Channel
received an user defined event.
This will result in having the ChannelInboundHandler.userEventTriggered(ChannelHandlerContext, Object)
method called of the next ChannelInboundHandler
contained in the ChannelPipeline
of the
Channel
.fireUserEventTriggered
in interface ChannelInboundInvoker
fireUserEventTriggered
in interface ChannelPipeline
public final ChannelPipeline fireChannelRead(Object msg)
ChannelInboundInvoker
Channel
received a message.
This will result in having the ChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
method called of the next ChannelInboundHandler
contained in the ChannelPipeline
of the
Channel
.fireChannelRead
in interface ChannelInboundInvoker
fireChannelRead
in interface ChannelPipeline
public final ChannelPipeline fireChannelReadComplete()
ChannelInboundInvoker
ChannelInboundHandler.channelReadComplete(ChannelHandlerContext)
event to the next ChannelInboundHandler
in the ChannelPipeline
.fireChannelReadComplete
in interface ChannelInboundInvoker
fireChannelReadComplete
in interface ChannelPipeline
public final ChannelPipeline fireChannelWritabilityChanged()
ChannelInboundInvoker
ChannelInboundHandler.channelWritabilityChanged(ChannelHandlerContext)
event to the next ChannelInboundHandler
in the ChannelPipeline
.fireChannelWritabilityChanged
in interface ChannelInboundInvoker
fireChannelWritabilityChanged
in interface ChannelPipeline
public final ChannelFuture bind(SocketAddress localAddress)
ChannelOutboundInvoker
SocketAddress
and notify the ChannelFuture
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 next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
bind
in interface ChannelOutboundInvoker
public final ChannelFuture connect(SocketAddress remoteAddress)
ChannelOutboundInvoker
SocketAddress
and notify the ChannelFuture
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
a ConnectTimeoutException
. If it fails because of connection refused a ConnectException
will be used.
This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)
method called of the next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
connect
in interface ChannelOutboundInvoker
public final ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress)
ChannelOutboundInvoker
SocketAddress
while bind to the localAddress and notify the
ChannelFuture
once the operation completes, either because the operation was successful or because of
an error.
This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)
method called of the next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
connect
in interface ChannelOutboundInvoker
public final ChannelFuture disconnect()
ChannelOutboundInvoker
ChannelFuture
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 next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
disconnect
in interface ChannelOutboundInvoker
public final ChannelFuture close()
ChannelOutboundInvoker
Channel
and notify the ChannelFuture
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 next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
close
in interface ChannelOutboundInvoker
public final ChannelFuture deregister()
ChannelOutboundInvoker
EventExecutor
and notify the
ChannelFuture
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 next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
deregister
in interface ChannelOutboundInvoker
public final ChannelPipeline flush()
ChannelOutboundInvoker
flush
in interface ChannelOutboundInvoker
flush
in interface ChannelPipeline
public final ChannelFuture bind(SocketAddress localAddress, ChannelPromise promise)
ChannelOutboundInvoker
SocketAddress
and notify the ChannelFuture
once the operation
completes, either because the operation was successful or because of an error.
The given ChannelPromise
will be notified.
This will result in having the
ChannelOutboundHandler.bind(ChannelHandlerContext, SocketAddress, ChannelPromise)
method
called of the next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
bind
in interface ChannelOutboundInvoker
public final ChannelFuture connect(SocketAddress remoteAddress, ChannelPromise promise)
ChannelOutboundInvoker
SocketAddress
and notify the ChannelFuture
once the operation
completes, either because the operation was successful or because of an error.
The given ChannelFuture
will be notified.
If the connection fails because of a connection timeout, the ChannelFuture
will get failed with
a ConnectTimeoutException
. If it fails because of connection refused a ConnectException
will be used.
This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)
method called of the next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
connect
in interface ChannelOutboundInvoker
public final ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise)
ChannelOutboundInvoker
SocketAddress
while bind to the localAddress and notify the
ChannelFuture
once the operation completes, either because the operation was successful or because of
an error.
The given ChannelPromise
will be notified and also returned.
This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)
method called of the next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
connect
in interface ChannelOutboundInvoker
public final ChannelFuture disconnect(ChannelPromise promise)
ChannelOutboundInvoker
ChannelFuture
once the operation completes,
either because the operation was successful or because of an error.
The given ChannelPromise
will be notified.
This will result in having the
ChannelOutboundHandler.disconnect(ChannelHandlerContext, ChannelPromise)
method called of the next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
disconnect
in interface ChannelOutboundInvoker
public final ChannelFuture close(ChannelPromise promise)
ChannelOutboundInvoker
Channel
and notify the ChannelFuture
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 given ChannelPromise
will be notified.
This will result in having the
ChannelOutboundHandler.close(ChannelHandlerContext, ChannelPromise)
method called of the next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
close
in interface ChannelOutboundInvoker
public final ChannelFuture deregister(ChannelPromise promise)
ChannelOutboundInvoker
EventExecutor
and notify the
ChannelFuture
once the operation completes, either because the operation was successful or because of
an error.
The given ChannelPromise
will be notified.
This will result in having the
ChannelOutboundHandler.deregister(ChannelHandlerContext, ChannelPromise)
method called of the next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
deregister
in interface ChannelOutboundInvoker
public final ChannelPipeline read()
ChannelOutboundInvoker
Channel
into the first inbound buffer, triggers an
ChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
event if data was
read, and triggers a
channelReadComplete
event so the
handler can decide to continue reading. 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 next ChannelOutboundHandler
contained in the ChannelPipeline
of the
Channel
.
read
in interface ChannelOutboundInvoker
public final ChannelFuture write(Object msg)
ChannelOutboundInvoker
ChannelHandlerContext
through the ChannelPipeline
.
This method will not request to actual flush, so be sure to call ChannelOutboundInvoker.flush()
once you want to request to flush all pending data to the actual transport.write
in interface ChannelOutboundInvoker
public final ChannelFuture write(Object msg, ChannelPromise promise)
ChannelOutboundInvoker
ChannelHandlerContext
through the ChannelPipeline
.
This method will not request to actual flush, so be sure to call ChannelOutboundInvoker.flush()
once you want to request to flush all pending data to the actual transport.write
in interface ChannelOutboundInvoker
public final ChannelFuture writeAndFlush(Object msg, ChannelPromise promise)
ChannelOutboundInvoker
ChannelOutboundInvoker.write(Object, ChannelPromise)
and ChannelOutboundInvoker.flush()
.writeAndFlush
in interface ChannelOutboundInvoker
public final ChannelFuture writeAndFlush(Object msg)
ChannelOutboundInvoker
ChannelOutboundInvoker.write(Object)
and ChannelOutboundInvoker.flush()
.writeAndFlush
in interface ChannelOutboundInvoker
public final ChannelPromise newPromise()
ChannelOutboundInvoker
ChannelPromise
.newPromise
in interface ChannelOutboundInvoker
public final ChannelProgressivePromise newProgressivePromise()
ChannelOutboundInvoker
ChannelProgressivePromise
newProgressivePromise
in interface ChannelOutboundInvoker
public final ChannelFuture newSucceededFuture()
ChannelOutboundInvoker
ChannelFuture
which is marked as succeeded already. So Future.isSuccess()
will return true
. All FutureListener
added to it will be notified directly. Also
every call of blocking methods will just return without blocking.newSucceededFuture
in interface ChannelOutboundInvoker
public final ChannelFuture newFailedFuture(Throwable cause)
ChannelOutboundInvoker
ChannelFuture
which is marked as failed already. So Future.isSuccess()
will return false
. All FutureListener
added to it will be notified directly. Also
every call of blocking methods will just return without blocking.newFailedFuture
in interface ChannelOutboundInvoker
public final ChannelPromise voidPromise()
ChannelOutboundInvoker
It's only supported to use
it for ChannelOutboundInvoker.write(Object, ChannelPromise)
.
Be aware that the returned 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 call
ChannelPipeline.fireExceptionCaught(Throwable)
in this case.
voidPromise
in interface ChannelOutboundInvoker
protected void onUnhandledInboundException(Throwable cause)
Throwable
hit the end of the ChannelPipeline
without been handled by the user
in ChannelHandler.exceptionCaught(ChannelHandlerContext, Throwable)
.protected void onUnhandledInboundChannelActive()
ChannelInboundHandler.channelActive(ChannelHandlerContext)
event hit
the end of the ChannelPipeline
.protected void onUnhandledInboundChannelInactive()
ChannelInboundHandler.channelInactive(ChannelHandlerContext)
event hit
the end of the ChannelPipeline
.protected void onUnhandledInboundMessage(Object msg)
ChannelPipeline
without been handled by the user
in ChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
. This method is responsible
to call ReferenceCountUtil.release(Object)
on the given msg at some point.protected void onUnhandledInboundMessage(ChannelHandlerContext ctx, Object msg)
ChannelPipeline
without been handled by the user
in ChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
. This method is responsible
to call ReferenceCountUtil.release(Object)
on the given msg at some point.protected void onUnhandledInboundChannelReadComplete()
ChannelInboundHandler.channelReadComplete(ChannelHandlerContext)
event hit
the end of the ChannelPipeline
.protected void onUnhandledInboundUserEventTriggered(Object evt)
ChannelPipeline
without been handled by the user
in ChannelInboundHandler.userEventTriggered(ChannelHandlerContext, Object)
. This method is responsible
to call ReferenceCountUtil.release(Object)
on the given event at some point.protected void onUnhandledChannelWritabilityChanged()
ChannelInboundHandler.channelWritabilityChanged(ChannelHandlerContext)
event hit
the end of the ChannelPipeline
.protected void incrementPendingOutboundBytes(long size)
protected void decrementPendingOutboundBytes(long size)
Copyright © 2008–2024 The Netty Project. All rights reserved.