private static class CombinedChannelDuplexHandler.DelegatingChannelHandlerContext extends java.lang.Object implements ChannelHandlerContext
Modifier and Type | Field and Description |
---|---|
private ChannelHandlerContext |
ctx |
private ChannelHandler |
handler |
(package private) boolean |
removed |
Constructor and Description |
---|
DelegatingChannelHandlerContext(ChannelHandlerContext ctx,
ChannelHandler handler) |
Modifier and Type | Method and Description |
---|---|
ByteBufAllocator |
alloc()
Return the assigned
ByteBufAllocator which will be used to allocate ByteBuf s. |
<T> Attribute<T> |
attr(AttributeKey<T> key)
Get the
Attribute for the given AttributeKey . |
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()
Return the
Channel which is bound to the ChannelHandlerContext . |
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(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. |
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. |
EventExecutor |
executor()
The
EventExecutor that is used to dispatch the events. |
ChannelHandlerContext |
fireChannelActive()
A
Channel is active now, which means it is connected. |
ChannelHandlerContext |
fireChannelInactive()
A
Channel is inactive now, which means it is closed. |
ChannelHandlerContext |
fireChannelRead(java.lang.Object msg)
A
Channel received a message. |
ChannelHandlerContext |
fireChannelReadComplete()
Triggers an
ChannelInboundHandler.channelReadComplete(ChannelHandlerContext)
event to the next ChannelInboundHandler in the ChannelPipeline . |
ChannelHandlerContext |
fireChannelRegistered()
|
ChannelHandlerContext |
fireChannelUnregistered()
|
ChannelHandlerContext |
fireChannelWritabilityChanged()
Triggers an
ChannelInboundHandler.channelWritabilityChanged(ChannelHandlerContext)
event to the next ChannelInboundHandler in the ChannelPipeline . |
ChannelHandlerContext |
fireExceptionCaught(java.lang.Throwable cause)
A
Channel received an Throwable in one of its inbound operations. |
ChannelHandlerContext |
fireUserEventTriggered(java.lang.Object event)
A
Channel received an user defined event. |
ChannelHandlerContext |
flush()
Request to flush all pending messages via this ChannelOutboundInvoker.
|
ChannelHandler |
handler()
The
ChannelHandler that is bound this ChannelHandlerContext . |
boolean |
isRemoved()
Return
true if the ChannelHandler which belongs to this context was removed
from the ChannelPipeline . |
java.lang.String |
name()
The unique name of the
ChannelHandlerContext .The name was used when then ChannelHandler
was added to the ChannelPipeline . |
ChannelFuture |
newFailedFuture(java.lang.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. |
ChannelPipeline |
pipeline()
Return the assigned
ChannelPipeline |
ChannelHandlerContext |
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. |
(package private) void |
remove() |
private void |
remove0() |
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 this
ChannelHandlerContext through the ChannelPipeline . |
ChannelFuture |
write(java.lang.Object msg,
ChannelPromise promise)
Request to write a message via this
ChannelHandlerContext through the ChannelPipeline . |
ChannelFuture |
writeAndFlush(java.lang.Object msg)
Shortcut for call
ChannelHandlerContext.write(Object) and ChannelHandlerContext.flush() . |
ChannelFuture |
writeAndFlush(java.lang.Object msg,
ChannelPromise promise)
Shortcut for call
ChannelHandlerContext.write(Object, ChannelPromise) and ChannelHandlerContext.flush() . |
private final ChannelHandlerContext ctx
private final ChannelHandler handler
boolean removed
DelegatingChannelHandlerContext(ChannelHandlerContext ctx, ChannelHandler handler)
public Channel channel()
ChannelHandlerContext
Channel
which is bound to the ChannelHandlerContext
.channel
in interface ChannelHandlerContext
public EventExecutor executor()
ChannelHandlerContext
EventExecutor
that is used to dispatch the events. This can also be used to directly
submit tasks that get executed in the event loop. For more information please refer to the
EventExecutor
javadoc.executor
in interface ChannelHandlerContext
public java.lang.String name()
ChannelHandlerContext
ChannelHandlerContext
.The name was used when then ChannelHandler
was added to the ChannelPipeline
. This name can also be used to access the registered
ChannelHandler
from the ChannelPipeline
.name
in interface ChannelHandlerContext
public ChannelHandler handler()
ChannelHandlerContext
ChannelHandler
that is bound this ChannelHandlerContext
.handler
in interface ChannelHandlerContext
public boolean isRemoved()
ChannelHandlerContext
true
if the ChannelHandler
which belongs to this context was removed
from the ChannelPipeline
. Note that this method is only meant to be called from with in the
EventLoop
.isRemoved
in interface ChannelHandlerContext
public ChannelHandlerContext fireChannelRegistered()
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelHandlerContext fireChannelUnregistered()
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelHandlerContext fireChannelActive()
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelHandlerContext fireChannelInactive()
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelHandlerContext fireExceptionCaught(java.lang.Throwable cause)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelHandlerContext fireUserEventTriggered(java.lang.Object event)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelHandlerContext fireChannelRead(java.lang.Object msg)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelHandlerContext fireChannelReadComplete()
ChannelHandlerContext
ChannelInboundHandler.channelReadComplete(ChannelHandlerContext)
event to the next ChannelInboundHandler
in the ChannelPipeline
.fireChannelReadComplete
in interface ChannelHandlerContext
public ChannelHandlerContext fireChannelWritabilityChanged()
ChannelHandlerContext
ChannelInboundHandler.channelWritabilityChanged(ChannelHandlerContext)
event to the next ChannelInboundHandler
in the ChannelPipeline
.fireChannelWritabilityChanged
in interface ChannelHandlerContext
public ChannelFuture bind(java.net.SocketAddress localAddress)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture connect(java.net.SocketAddress remoteAddress)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture disconnect()
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture close()
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture deregister()
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture bind(java.net.SocketAddress localAddress, ChannelPromise promise)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture connect(java.net.SocketAddress remoteAddress, ChannelPromise promise)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture disconnect(ChannelPromise promise)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture close(ChannelPromise promise)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture deregister(ChannelPromise promise)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelHandlerContext read()
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture write(java.lang.Object msg)
ChannelHandlerContext
ChannelHandlerContext
through the ChannelPipeline
.
This method will not request to actual flush, so be sure to call ChannelHandlerContext.flush()
once you want to request to flush all pending data to the actual transport.write
in interface ChannelHandlerContext
public ChannelFuture write(java.lang.Object msg, ChannelPromise promise)
ChannelHandlerContext
ChannelHandlerContext
through the ChannelPipeline
.
This method will not request to actual flush, so be sure to call ChannelHandlerContext.flush()
once you want to request to flush all pending data to the actual transport.write
in interface ChannelHandlerContext
public ChannelHandlerContext flush()
ChannelHandlerContext
flush
in interface ChannelHandlerContext
public ChannelFuture writeAndFlush(java.lang.Object msg, ChannelPromise promise)
ChannelHandlerContext
ChannelHandlerContext.write(Object, ChannelPromise)
and ChannelHandlerContext.flush()
.writeAndFlush
in interface ChannelHandlerContext
public ChannelFuture writeAndFlush(java.lang.Object msg)
ChannelHandlerContext
ChannelHandlerContext.write(Object)
and ChannelHandlerContext.flush()
.writeAndFlush
in interface ChannelHandlerContext
public ChannelPipeline pipeline()
ChannelHandlerContext
ChannelPipeline
pipeline
in interface ChannelHandlerContext
public ByteBufAllocator alloc()
ChannelHandlerContext
ByteBufAllocator
which will be used to allocate ByteBuf
s.alloc
in interface ChannelHandlerContext
public ChannelPromise newPromise()
ChannelHandlerContext
ChannelPromise
.newPromise
in interface ChannelHandlerContext
public ChannelProgressivePromise newProgressivePromise()
ChannelHandlerContext
ChannelProgressivePromise
newProgressivePromise
in interface ChannelHandlerContext
public ChannelFuture newSucceededFuture()
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelFuture newFailedFuture(java.lang.Throwable cause)
ChannelHandlerContext
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 ChannelHandlerContext
public ChannelPromise voidPromise()
ChannelHandlerContext
It's only supported to use
it for ChannelHandlerContext.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 ChannelHandlerContext
public <T> Attribute<T> attr(AttributeKey<T> key)
AttributeMap
Attribute
for the given AttributeKey
. This method will never return null, but may return
an Attribute
which does not have a value set yet.attr
in interface AttributeMap
final void remove()
private void remove0()