public class DefaultChannelPipeline extends java.lang.Object implements ChannelPipeline
ChannelPipeline
implementation. It is usually created
by a Channel
implementation when the Channel
is created.限定符 | 构造器和说明 |
---|---|
protected |
DefaultChannelPipeline(Channel channel) |
限定符和类型 | 方法和说明 |
---|---|
ChannelPipeline |
addAfter(EventExecutorGroup group,
java.lang.String baseName,
java.lang.String name,
ChannelHandler handler)
Inserts a
ChannelHandler after an existing handler of this
pipeline. |
ChannelPipeline |
addAfter(java.lang.String baseName,
java.lang.String name,
ChannelHandler handler)
Inserts a
ChannelHandler after an existing handler of this
pipeline. |
ChannelPipeline |
addBefore(EventExecutorGroup group,
java.lang.String baseName,
java.lang.String name,
ChannelHandler handler)
Inserts a
ChannelHandler before an existing handler of this
pipeline. |
ChannelPipeline |
addBefore(java.lang.String baseName,
java.lang.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(EventExecutorGroup executor,
ChannelHandler... handlers)
Inserts
ChannelHandler s at the first position of this pipeline. |
ChannelPipeline |
addFirst(EventExecutorGroup group,
java.lang.String name,
ChannelHandler handler)
Inserts a
ChannelHandler at the first position of this pipeline. |
ChannelPipeline |
addFirst(java.lang.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(EventExecutorGroup executor,
ChannelHandler... handlers)
Inserts
ChannelHandler s at the last position of this pipeline. |
ChannelPipeline |
addLast(EventExecutorGroup group,
java.lang.String name,
ChannelHandler handler)
Appends a
ChannelHandler at the last position of this pipeline. |
ChannelPipeline |
addLast(java.lang.String name,
ChannelHandler handler)
Appends a
ChannelHandler at the last position of this pipeline. |
ChannelFuture |
bind(java.net.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(java.net.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 bound to this ChannelPipeline and notify the ChannelFuture
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 given
SocketAddress and notify the ChannelFuture 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 given
SocketAddress and notify the ChannelFuture 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 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(java.net.SocketAddress remoteAddress,
java.net.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(java.lang.Class<? extends ChannelHandler> handlerType)
Returns the context object of the
ChannelHandler of the
specified type in this pipeline. |
ChannelHandlerContext |
context(java.lang.String name)
Returns the context object of the
ChannelHandler with the
specified name in this pipeline. |
ChannelFuture |
deregister()
Request to deregister the
Channel 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 the
Channel bound this ChannelPipeline 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(java.lang.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(java.lang.Throwable cause)
A
Channel received an Throwable in one of its inbound operations. |
ChannelPipeline |
fireUserEventTriggered(java.lang.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.
|
<T extends ChannelHandler> |
get(java.lang.Class<T> handlerType)
Returns the
ChannelHandler of the specified type in this
pipeline. |
ChannelHandler |
get(java.lang.String name)
Returns the
ChannelHandler with the specified name in this
pipeline. |
java.util.Iterator<java.util.Map.Entry<java.lang.String,ChannelHandler>> |
iterator() |
ChannelHandler |
last()
Returns the last
ChannelHandler in this pipeline. |
ChannelHandlerContext |
lastContext()
Returns the context of the last
ChannelHandler in this pipeline. |
java.util.List<java.lang.String> |
names()
Returns the
List of the handler names. |
protected void |
onUnhandledInboundException(java.lang.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(java.lang.Object msg)
Called once a message hit the end of the
ChannelPipeline without been handled by the user
in ChannelInboundHandler.channelRead(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(java.lang.Class<T> handlerType)
Removes the
ChannelHandler of the specified type from this pipeline. |
ChannelHandler |
remove(java.lang.String name)
Removes the
ChannelHandler with the specified name from this pipeline. |
ChannelHandler |
removeFirst()
Removes the first
ChannelHandler in this pipeline. |
ChannelHandler |
removeLast()
Removes the last
ChannelHandler in this pipeline. |
ChannelPipeline |
replace(ChannelHandler oldHandler,
java.lang.String newName,
ChannelHandler newHandler)
Replaces the specified
ChannelHandler with a new handler in this pipeline. |
<T extends ChannelHandler> |
replace(java.lang.Class<T> oldHandlerType,
java.lang.String newName,
ChannelHandler newHandler)
Replaces the
ChannelHandler of the specified type with a new handler in this pipeline. |
ChannelHandler |
replace(java.lang.String oldName,
java.lang.String newName,
ChannelHandler newHandler)
Replaces the
ChannelHandler of the specified name with a new handler in this pipeline. |
java.util.Map<java.lang.String,ChannelHandler> |
toMap()
Converts this pipeline into an ordered
Map whose keys are
handler names and whose values are handlers. |
java.lang.String |
toString()
Returns the
String representation of this pipeline. |
ChannelFuture |
write(java.lang.Object msg)
Request to write a message via this
ChannelPipeline . |
ChannelFuture |
write(java.lang.Object msg,
ChannelPromise promise)
Request to write a message via this
ChannelPipeline . |
ChannelFuture |
writeAndFlush(java.lang.Object msg)
Shortcut for call
ChannelPipeline.write(Object) and ChannelPipeline.flush() . |
ChannelFuture |
writeAndFlush(java.lang.Object msg,
ChannelPromise promise)
Shortcut for call
ChannelPipeline.write(Object, ChannelPromise) and ChannelPipeline.flush() . |
protected DefaultChannelPipeline(Channel channel)
public final Channel channel()
ChannelPipeline
Channel
that this pipeline is attached to.channel
在接口中 ChannelPipeline
null
if this pipeline is not attached yet.public final ChannelPipeline addFirst(java.lang.String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
at the first position of this pipeline.addFirst
在接口中 ChannelPipeline
name
- the name of the handler to insert firsthandler
- the handler to insert firstpublic final ChannelPipeline addFirst(EventExecutorGroup group, java.lang.String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
at the first position of this pipeline.addFirst
在接口中 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(java.lang.String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
at the last position of this pipeline.addLast
在接口中 ChannelPipeline
name
- the name of the handler to appendhandler
- the handler to appendpublic final ChannelPipeline addLast(EventExecutorGroup group, java.lang.String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
at the last position of this pipeline.addLast
在接口中 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(java.lang.String baseName, java.lang.String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
before an existing handler of this
pipeline.addBefore
在接口中 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, java.lang.String baseName, java.lang.String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
before an existing handler of this
pipeline.addBefore
在接口中 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(java.lang.String baseName, java.lang.String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
after an existing handler of this
pipeline.addAfter
在接口中 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, java.lang.String baseName, java.lang.String name, ChannelHandler handler)
ChannelPipeline
ChannelHandler
after an existing handler of this
pipeline.addAfter
在接口中 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... handlers)
ChannelPipeline
ChannelHandler
s at the first position of this pipeline.addFirst
在接口中 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
在接口中 ChannelPipeline
executor
- the EventExecutorGroup
which will be used to execute the ChannelHandler
s
methods.handlers
- the handlers to insert firstpublic final ChannelPipeline addLast(ChannelHandler... handlers)
ChannelPipeline
ChannelHandler
s at the last position of this pipeline.addLast
在接口中 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
在接口中 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
在接口中 ChannelPipeline
handler
- the ChannelHandler
to removepublic final ChannelHandler remove(java.lang.String name)
ChannelPipeline
ChannelHandler
with the specified name from this pipeline.remove
在接口中 ChannelPipeline
name
- the name under which the ChannelHandler
was stored.public final <T extends ChannelHandler> T remove(java.lang.Class<T> handlerType)
ChannelPipeline
ChannelHandler
of the specified type from this pipeline.remove
在接口中 ChannelPipeline
T
- the type of the handlerhandlerType
- the type of the handlerpublic final ChannelHandler removeFirst()
ChannelPipeline
ChannelHandler
in this pipeline.removeFirst
在接口中 ChannelPipeline
public final ChannelHandler removeLast()
ChannelPipeline
ChannelHandler
in this pipeline.removeLast
在接口中 ChannelPipeline
public final ChannelPipeline replace(ChannelHandler oldHandler, java.lang.String newName, ChannelHandler newHandler)
ChannelPipeline
ChannelHandler
with a new handler in this pipeline.replace
在接口中 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(java.lang.String oldName, java.lang.String newName, ChannelHandler newHandler)
ChannelPipeline
ChannelHandler
of the specified name with a new handler in this pipeline.replace
在接口中 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(java.lang.Class<T> oldHandlerType, java.lang.String newName, ChannelHandler newHandler)
ChannelPipeline
ChannelHandler
of the specified type with a new handler in this pipeline.replace
在接口中 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
在接口中 ChannelPipeline
null
if this pipeline is empty.public final ChannelHandlerContext firstContext()
ChannelPipeline
ChannelHandler
in this pipeline.firstContext
在接口中 ChannelPipeline
null
if this pipeline is empty.public final ChannelHandler last()
ChannelPipeline
ChannelHandler
in this pipeline.last
在接口中 ChannelPipeline
null
if this pipeline is empty.public final ChannelHandlerContext lastContext()
ChannelPipeline
ChannelHandler
in this pipeline.lastContext
在接口中 ChannelPipeline
null
if this pipeline is empty.public final ChannelHandler get(java.lang.String name)
ChannelPipeline
ChannelHandler
with the specified name in this
pipeline.get
在接口中 ChannelPipeline
null
if there's no such handler in this pipeline.public final <T extends ChannelHandler> T get(java.lang.Class<T> handlerType)
ChannelPipeline
ChannelHandler
of the specified type in this
pipeline.get
在接口中 ChannelPipeline
null
if there's no such handler in this pipeline.public final ChannelHandlerContext context(java.lang.String name)
ChannelPipeline
ChannelHandler
with the
specified name in this pipeline.context
在接口中 ChannelPipeline
null
if there's no such handler in this pipeline.public final ChannelHandlerContext context(ChannelHandler handler)
ChannelPipeline
ChannelHandler
in
this pipeline.context
在接口中 ChannelPipeline
null
if there's no such handler in this pipeline.public final ChannelHandlerContext context(java.lang.Class<? extends ChannelHandler> handlerType)
ChannelPipeline
ChannelHandler
of the
specified type in this pipeline.context
在接口中 ChannelPipeline
null
if there's no such handler in this pipeline.public final java.util.List<java.lang.String> names()
ChannelPipeline
List
of the handler names.names
在接口中 ChannelPipeline
public final java.util.Map<java.lang.String,ChannelHandler> toMap()
ChannelPipeline
Map
whose keys are
handler names and whose values are handlers.toMap
在接口中 ChannelPipeline
public final java.util.Iterator<java.util.Map.Entry<java.lang.String,ChannelHandler>> iterator()
iterator
在接口中 java.lang.Iterable<java.util.Map.Entry<java.lang.String,ChannelHandler>>
public final java.lang.String toString()
String
representation of this pipeline.toString
在类中 java.lang.Object
public final ChannelPipeline fireChannelRegistered()
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelPipeline fireChannelUnregistered()
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelPipeline fireChannelActive()
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelPipeline fireChannelInactive()
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelPipeline fireExceptionCaught(java.lang.Throwable cause)
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelPipeline fireUserEventTriggered(java.lang.Object event)
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelPipeline fireChannelRead(java.lang.Object msg)
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelPipeline fireChannelReadComplete()
ChannelPipeline
ChannelInboundHandler.channelReadComplete(ChannelHandlerContext)
event to the next ChannelInboundHandler
in the ChannelPipeline
.fireChannelReadComplete
在接口中 ChannelPipeline
public final ChannelPipeline fireChannelWritabilityChanged()
ChannelPipeline
ChannelInboundHandler.channelWritabilityChanged(ChannelHandlerContext)
event to the next ChannelInboundHandler
in the ChannelPipeline
.fireChannelWritabilityChanged
在接口中 ChannelPipeline
public final ChannelFuture bind(java.net.SocketAddress localAddress)
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelFuture connect(java.net.SocketAddress remoteAddress)
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelFuture connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelFuture disconnect()
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelFuture close()
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelFuture deregister()
ChannelPipeline
Channel
from the previous assigned 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
在接口中 ChannelPipeline
public final ChannelPipeline flush()
ChannelPipeline
flush
在接口中 ChannelPipeline
public final ChannelFuture bind(java.net.SocketAddress localAddress, ChannelPromise promise)
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelFuture connect(java.net.SocketAddress remoteAddress, ChannelPromise promise)
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelFuture connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelFuture disconnect(ChannelPromise promise)
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelFuture close(ChannelPromise promise)
ChannelPipeline
Channel
bound to this ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelFuture deregister(ChannelPromise promise)
ChannelPipeline
Channel
bound this ChannelPipeline
from the previous assigned
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
在接口中 ChannelPipeline
public final ChannelPipeline read()
ChannelPipeline
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
在接口中 ChannelPipeline
public final ChannelFuture write(java.lang.Object msg)
ChannelPipeline
ChannelPipeline
.
This method will not request to actual flush, so be sure to call ChannelPipeline.flush()
once you want to request to flush all pending data to the actual transport.write
在接口中 ChannelPipeline
public final ChannelFuture write(java.lang.Object msg, ChannelPromise promise)
ChannelPipeline
ChannelPipeline
.
This method will not request to actual flush, so be sure to call ChannelPipeline.flush()
once you want to request to flush all pending data to the actual transport.write
在接口中 ChannelPipeline
public final ChannelFuture writeAndFlush(java.lang.Object msg, ChannelPromise promise)
ChannelPipeline
ChannelPipeline.write(Object, ChannelPromise)
and ChannelPipeline.flush()
.writeAndFlush
在接口中 ChannelPipeline
public final ChannelFuture writeAndFlush(java.lang.Object msg)
ChannelPipeline
ChannelPipeline.write(Object)
and ChannelPipeline.flush()
.writeAndFlush
在接口中 ChannelPipeline
protected void onUnhandledInboundException(java.lang.Throwable cause)
Throwable
hit the end of the ChannelPipeline
without been handled by the user
in ChannelHandler.exceptionCaught(ChannelHandlerContext, Throwable)
.protected void onUnhandledInboundMessage(java.lang.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.