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
Fields Modifier and Type Field Description private Channel.Unsafeunsafe-
Fields inherited from class io.netty.channel.AbstractChannelHandlerContext
executor, next, prev
-
-
Constructor Summary
Constructors Constructor Description HeadContext(DefaultChannelPipeline pipeline)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(ChannelHandlerContext ctx, java.net.SocketAddress localAddress, ChannelPromise promise)Called once a bind operation is made.voidchannelActive(ChannelHandlerContext ctx)TheChannelof theChannelHandlerContextis now activevoidchannelInactive(ChannelHandlerContext ctx)TheChannelof theChannelHandlerContextwas registered is now inactive and reached its end of lifetime.voidchannelRead(ChannelHandlerContext ctx, java.lang.Object msg)Invoked when the currentChannelhas read a message from the peer.voidchannelReadComplete(ChannelHandlerContext ctx)Invoked when the last message read by the current read operation has been consumed byChannelInboundHandler.channelRead(ChannelHandlerContext, Object).voidchannelRegistered(ChannelHandlerContext ctx)voidchannelUnregistered(ChannelHandlerContext ctx)voidchannelWritabilityChanged(ChannelHandlerContext ctx)Gets called once the writable state of aChannelchanged.voidclose(ChannelHandlerContext ctx, ChannelPromise promise)Called once a close operation is made.voidconnect(ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)Called once a connect operation is made.voidderegister(ChannelHandlerContext ctx, ChannelPromise promise)Called once a deregister operation is made from the current registeredEventLoop.voiddisconnect(ChannelHandlerContext ctx, ChannelPromise promise)Called once a disconnect operation is made.voidexceptionCaught(ChannelHandlerContext ctx, java.lang.Throwable cause)Gets called if aThrowablewas thrown.voidflush(ChannelHandlerContext ctx)Called once a flush operation is made.ChannelHandlerhandler()TheChannelHandlerthat is bound thisChannelHandlerContext.voidhandlerAdded(ChannelHandlerContext ctx)Gets called after theChannelHandlerwas added to the actual context and it's ready to handle events.voidhandlerRemoved(ChannelHandlerContext ctx)Gets called after theChannelHandlerwas removed from the actual context and it doesn't handle events anymore.voidread(ChannelHandlerContext ctx)InterceptsChannelHandlerContext.read().private voidreadIfIsAutoRead()voiduserEventTriggered(ChannelHandlerContext ctx, java.lang.Object evt)Gets called if an user event was triggered.voidwrite(ChannelHandlerContext ctx, java.lang.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 Detail
-
unsafe
private final Channel.Unsafe unsafe
-
-
Constructor Detail
-
HeadContext
HeadContext(DefaultChannelPipeline pipeline)
-
-
Method Detail
-
handler
public ChannelHandler handler()
Description copied from interface:ChannelHandlerContextTheChannelHandlerthat is bound thisChannelHandlerContext.- Specified by:
handlerin interfaceChannelHandlerContext
-
handlerAdded
public void handlerAdded(ChannelHandlerContext ctx)
Description copied from interface:ChannelHandlerGets called after theChannelHandlerwas added to the actual context and it's ready to handle events.- Specified by:
handlerAddedin interfaceChannelHandler
-
handlerRemoved
public void handlerRemoved(ChannelHandlerContext ctx)
Description copied from interface:ChannelHandlerGets called after theChannelHandlerwas removed from the actual context and it doesn't handle events anymore.- Specified by:
handlerRemovedin interfaceChannelHandler
-
bind
public void bind(ChannelHandlerContext ctx, java.net.SocketAddress localAddress, ChannelPromise promise)
Description copied from interface:ChannelOutboundHandlerCalled once a bind operation is made.- Specified by:
bindin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the bind operation is madelocalAddress- theSocketAddressto which it should boundpromise- theChannelPromiseto notify once the operation completes
-
connect
public void connect(ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)
Description copied from interface:ChannelOutboundHandlerCalled once a connect operation is made.- Specified by:
connectin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the connect operation is maderemoteAddress- theSocketAddressto which it should connectlocalAddress- theSocketAddresswhich is used as source on connectpromise- theChannelPromiseto notify once the operation completes
-
disconnect
public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise)
Description copied from interface:ChannelOutboundHandlerCalled once a disconnect operation is made.- Specified by:
disconnectin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the disconnect operation is madepromise- theChannelPromiseto notify once the operation completes
-
close
public void close(ChannelHandlerContext ctx, ChannelPromise promise)
Description copied from interface:ChannelOutboundHandlerCalled once a close operation is made.- Specified by:
closein interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the close operation is madepromise- theChannelPromiseto notify once the operation completes
-
deregister
public void deregister(ChannelHandlerContext ctx, ChannelPromise promise)
Description copied from interface:ChannelOutboundHandlerCalled once a deregister operation is made from the current registeredEventLoop.- Specified by:
deregisterin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the close operation is madepromise- theChannelPromiseto notify once the operation completes
-
read
public void read(ChannelHandlerContext ctx)
Description copied from interface:ChannelOutboundHandlerInterceptsChannelHandlerContext.read().- Specified by:
readin interfaceChannelOutboundHandler
-
write
public void write(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise)
Description copied from interface:ChannelOutboundHandlerCalled once a write operation is made. The write operation will write the messages through theChannelPipeline. Those are then ready to be flushed to the actualChannelonceChannel.flush()is called- Specified by:
writein interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the write operation is mademsg- the message to writepromise- theChannelPromiseto notify once the operation completes
-
flush
public void flush(ChannelHandlerContext ctx)
Description copied from interface:ChannelOutboundHandlerCalled once a flush operation is made. The flush operation will try to flush out all previous written messages that are pending.- Specified by:
flushin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the flush operation is made
-
exceptionCaught
public void exceptionCaught(ChannelHandlerContext ctx, java.lang.Throwable cause)
Description copied from interface:ChannelHandlerGets called if aThrowablewas thrown.- Specified by:
exceptionCaughtin interfaceChannelHandler- Specified by:
exceptionCaughtin interfaceChannelInboundHandler
-
channelRegistered
public void channelRegistered(ChannelHandlerContext ctx)
Description copied from interface:ChannelInboundHandler- Specified by:
channelRegisteredin interfaceChannelInboundHandler
-
channelUnregistered
public void channelUnregistered(ChannelHandlerContext ctx)
Description copied from interface:ChannelInboundHandler- Specified by:
channelUnregisteredin interfaceChannelInboundHandler
-
channelActive
public void channelActive(ChannelHandlerContext ctx)
Description copied from interface:ChannelInboundHandlerTheChannelof theChannelHandlerContextis now active- Specified by:
channelActivein interfaceChannelInboundHandler
-
channelInactive
public void channelInactive(ChannelHandlerContext ctx)
Description copied from interface:ChannelInboundHandlerTheChannelof theChannelHandlerContextwas registered is now inactive and reached its end of lifetime.- Specified by:
channelInactivein interfaceChannelInboundHandler
-
channelRead
public void channelRead(ChannelHandlerContext ctx, java.lang.Object msg)
Description copied from interface:ChannelInboundHandlerInvoked when the currentChannelhas read a message from the peer.- Specified by:
channelReadin interfaceChannelInboundHandler
-
channelReadComplete
public void channelReadComplete(ChannelHandlerContext ctx)
Description copied from interface:ChannelInboundHandlerInvoked when the last message read by the current read operation has been consumed byChannelInboundHandler.channelRead(ChannelHandlerContext, Object). IfChannelOption.AUTO_READis off, no further attempt to read an inbound data from the currentChannelwill be made untilChannelHandlerContext.read()is called.- Specified by:
channelReadCompletein interfaceChannelInboundHandler
-
readIfIsAutoRead
private void readIfIsAutoRead()
-
userEventTriggered
public void userEventTriggered(ChannelHandlerContext ctx, java.lang.Object evt)
Description copied from interface:ChannelInboundHandlerGets called if an user event was triggered.- Specified by:
userEventTriggeredin interfaceChannelInboundHandler
-
channelWritabilityChanged
public void channelWritabilityChanged(ChannelHandlerContext ctx)
Description copied from interface:ChannelInboundHandlerGets called once the writable state of aChannelchanged. You can check the state withChannel.isWritable().- Specified by:
channelWritabilityChangedin interfaceChannelInboundHandler
-
-