Package io.netty.channel
Class DefaultChannelPipeline.HeadContext
java.lang.Object
io.netty.channel.AbstractChannelHandlerContext
io.netty.channel.DefaultChannelPipeline.HeadContext
- All Implemented Interfaces:
ChannelHandler
,ChannelHandlerContext
,ChannelInboundHandler
,ChannelInboundInvoker
,ChannelOutboundHandler
,ChannelOutboundInvoker
,AttributeMap
,ResourceLeakHint
- Enclosing class:
DefaultChannelPipeline
final class DefaultChannelPipeline.HeadContext
extends AbstractChannelHandlerContext
implements ChannelOutboundHandler, ChannelInboundHandler
-
Nested Class Summary
Nested classes/interfaces inherited from class io.netty.channel.AbstractChannelHandlerContext
AbstractChannelHandlerContext.WriteTask
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
Field Summary
FieldsFields inherited from class io.netty.channel.AbstractChannelHandlerContext
executor, next, prev
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) Called once a bind operation is made.void
TheChannel
of theChannelHandlerContext
is now activevoid
TheChannel
of theChannelHandlerContext
was registered is now inactive and reached its end of lifetime.void
channelRead
(ChannelHandlerContext ctx, Object msg) Invoked when the currentChannel
has read a message from the peer.void
Invoked when the last message read by the current read operation has been consumed byChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
.void
void
void
Gets called once the writable state of aChannel
changed.void
close
(ChannelHandlerContext ctx, ChannelPromise promise) Called once a close operation is made.void
connect
(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) Called once a connect operation is made.void
deregister
(ChannelHandlerContext ctx, ChannelPromise promise) Called once a deregister operation is made from the current registeredEventLoop
.void
disconnect
(ChannelHandlerContext ctx, ChannelPromise promise) Called once a disconnect operation is made.void
exceptionCaught
(ChannelHandlerContext ctx, Throwable cause) Gets called if aThrowable
was thrown.void
Called once a flush operation is made.handler()
TheChannelHandler
that is bound thisChannelHandlerContext
.void
Gets called after theChannelHandler
was added to the actual context and it's ready to handle events.void
Gets called after theChannelHandler
was removed from the actual context and it doesn't handle events anymore.void
InterceptsChannelHandlerContext.read()
.private void
void
userEventTriggered
(ChannelHandlerContext ctx, Object evt) Gets called if an user event was triggered.void
write
(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) Called once a write operation is made.Methods inherited from class io.netty.channel.AbstractChannelHandlerContext
alloc, attr, bind, bind, callHandlerAdded, callHandlerRemoved, channel, close, close, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, executor, fireChannelActive, fireChannelInactive, fireChannelRead, fireChannelReadComplete, fireChannelRegistered, fireChannelUnregistered, fireChannelWritabilityChanged, fireExceptionCaught, fireUserEventTriggered, flush, hasAttr, invokeChannelActive, invokeChannelInactive, invokeChannelRead, invokeChannelReadComplete, invokeChannelRegistered, invokeChannelUnregistered, invokeChannelWritabilityChanged, invokeExceptionCaught, invokeUserEventTriggered, invokeWrite, invokeWriteAndFlush, isRemoved, name, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, pipeline, read, setAddComplete, setAddPending, setRemoved, toHintString, toString, voidPromise, write, write, writeAndFlush, writeAndFlush
-
Field Details
-
unsafe
-
-
Constructor Details
-
HeadContext
HeadContext(DefaultChannelPipeline pipeline)
-
-
Method Details
-
handler
Description copied from interface:ChannelHandlerContext
TheChannelHandler
that is bound thisChannelHandlerContext
.- Specified by:
handler
in interfaceChannelHandlerContext
-
handlerAdded
Description copied from interface:ChannelHandler
Gets called after theChannelHandler
was added to the actual context and it's ready to handle events.- Specified by:
handlerAdded
in interfaceChannelHandler
-
handlerRemoved
Description copied from interface:ChannelHandler
Gets called after theChannelHandler
was removed from the actual context and it doesn't handle events anymore.- Specified by:
handlerRemoved
in interfaceChannelHandler
-
bind
Description copied from interface:ChannelOutboundHandler
Called once a bind operation is made.- Specified by:
bind
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the bind operation is madelocalAddress
- theSocketAddress
to which it should boundpromise
- theChannelPromise
to notify once the operation completes
-
connect
public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) Description copied from interface:ChannelOutboundHandler
Called once a connect operation is made.- Specified by:
connect
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the connect operation is maderemoteAddress
- theSocketAddress
to which it should connectlocalAddress
- theSocketAddress
which is used as source on connectpromise
- theChannelPromise
to notify once the operation completes
-
disconnect
Description copied from interface:ChannelOutboundHandler
Called once a disconnect operation is made.- Specified by:
disconnect
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the disconnect operation is madepromise
- theChannelPromise
to notify once the operation completes
-
close
Description copied from interface:ChannelOutboundHandler
Called once a close operation is made.- Specified by:
close
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the close operation is madepromise
- theChannelPromise
to notify once the operation completes
-
deregister
Description copied from interface:ChannelOutboundHandler
Called once a deregister operation is made from the current registeredEventLoop
.- Specified by:
deregister
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the close operation is madepromise
- theChannelPromise
to notify once the operation completes
-
read
Description copied from interface:ChannelOutboundHandler
InterceptsChannelHandlerContext.read()
.- Specified by:
read
in interfaceChannelOutboundHandler
-
write
Description copied from interface:ChannelOutboundHandler
Called once a write operation is made. The write operation will write the messages through theChannelPipeline
. Those are then ready to be flushed to the actualChannel
onceChannel.flush()
is called- Specified by:
write
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the write operation is mademsg
- the message to writepromise
- theChannelPromise
to notify once the operation completes
-
flush
Description copied from interface:ChannelOutboundHandler
Called once a flush operation is made. The flush operation will try to flush out all previous written messages that are pending.- Specified by:
flush
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the flush operation is made
-
exceptionCaught
Description copied from interface:ChannelHandler
Gets called if aThrowable
was thrown.- Specified by:
exceptionCaught
in interfaceChannelHandler
- Specified by:
exceptionCaught
in interfaceChannelInboundHandler
-
channelRegistered
Description copied from interface:ChannelInboundHandler
- Specified by:
channelRegistered
in interfaceChannelInboundHandler
-
channelUnregistered
Description copied from interface:ChannelInboundHandler
- Specified by:
channelUnregistered
in interfaceChannelInboundHandler
-
channelActive
Description copied from interface:ChannelInboundHandler
TheChannel
of theChannelHandlerContext
is now active- Specified by:
channelActive
in interfaceChannelInboundHandler
-
channelInactive
Description copied from interface:ChannelInboundHandler
TheChannel
of theChannelHandlerContext
was registered is now inactive and reached its end of lifetime.- Specified by:
channelInactive
in interfaceChannelInboundHandler
-
channelRead
Description copied from interface:ChannelInboundHandler
Invoked when the currentChannel
has read a message from the peer.- Specified by:
channelRead
in interfaceChannelInboundHandler
-
channelReadComplete
Description copied from interface:ChannelInboundHandler
Invoked when the last message read by the current read operation has been consumed byChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
. IfChannelOption.AUTO_READ
is off, no further attempt to read an inbound data from the currentChannel
will be made untilChannelHandlerContext.read()
is called.- Specified by:
channelReadComplete
in interfaceChannelInboundHandler
-
readIfIsAutoRead
private void readIfIsAutoRead() -
userEventTriggered
Description copied from interface:ChannelInboundHandler
Gets called if an user event was triggered.- Specified by:
userEventTriggered
in interfaceChannelInboundHandler
-
channelWritabilityChanged
Description copied from interface:ChannelInboundHandler
Gets called once the writable state of aChannel
changed. You can check the state withChannel.isWritable()
.- Specified by:
channelWritabilityChanged
in interfaceChannelInboundHandler
-