- java.lang.Object
-
- io.netty5.channel.internal.DelegatingChannelHandlerContext
-
- All Implemented Interfaces:
ChannelHandlerContext,ChannelInboundInvoker,ChannelOutboundInvoker,io.netty5.util.concurrent.FuturePromiseFactory
public abstract class DelegatingChannelHandlerContext extends Object implements ChannelHandlerContext
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDelegatingChannelHandlerContext(ChannelHandlerContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.netty5.util.concurrent.Future<Void>bind(SocketAddress localAddress)Request to bind to the givenSocketAddressand notify theFutureonce the operation completes, either because the operation was successful or because of an error.io.netty5.buffer.BufferAllocatorbufferAllocator()Return the assignedBufferAllocatorwhich will be used to allocateBuffers.Channelchannel()Return theChannelwhich is bound to theChannelHandlerContext.io.netty5.util.concurrent.Future<Void>close()Request to close theChanneland notify theFutureonce the operation completes, either because the operation was successful or because of an error.io.netty5.util.concurrent.Future<Void>connect(SocketAddress remoteAddress)Request to connect to the givenSocketAddressand notify theFutureonce the operation completes, either because the operation was successful or because of an error.io.netty5.util.concurrent.Future<Void>connect(SocketAddress remoteAddress, SocketAddress localAddress)Request to connect to the givenSocketAddresswhile bind to the localAddress and notify theFutureonce the operation completes, either because the operation was successful or because of an error.ChannelHandlerContextdelegatingCtx()io.netty5.util.concurrent.Future<Void>deregister()Request to deregister from the previous assignedEventExecutorand notify theFutureonce the operation completes, either because the operation was successful or because of an error.io.netty5.util.concurrent.Future<Void>disconnect()Request to disconnect from the remote peer and notify theFutureonce the operation completes, either because the operation was successful or because of an error.io.netty5.util.concurrent.EventExecutorexecutor()Returns theEventExecutorthat is used to execute the operations of thisChannelOutboundInvoker.ChannelHandlerContextfireChannelActive()AChannelis active now, which means it is connected.ChannelHandlerContextfireChannelExceptionCaught(Throwable cause)ChannelHandlerContextfireChannelInactive()AChannelis inactive now, which means it is closed.ChannelHandlerContextfireChannelInboundEvent(Object evt)AChannelreceived a custom defined inbound event.ChannelHandlerContextfireChannelRead(Object msg)AChannelreceived a message.ChannelHandlerContextfireChannelReadComplete()Triggers anChannelHandler.channelReadComplete(ChannelHandlerContext)event to the nextChannelHandlerin theChannelPipeline.ChannelHandlerContextfireChannelRegistered()ChannelHandlerContextfireChannelShutdown(ChannelShutdownDirection direction)AChannelwas shutdown in a specific direction.ChannelHandlerContextfireChannelUnregistered()ChannelHandlerContextfireChannelWritabilityChanged()Triggers anChannelHandler.channelWritabilityChanged(ChannelHandlerContext)event to the nextChannelHandlerin theChannelPipeline.ChannelHandlerContextflush()Request to flush all pending messages via this ChannelOutboundInvoker.ChannelHandlerhandler()TheChannelHandlerthat is bound thisChannelHandlerContext.booleanisRemoved()Returntrueif theChannelHandlerwhich belongs to this context was removed from theChannelPipeline.Stringname()The unique name of theChannelHandlerContext.The name was used when thenChannelHandlerwas added to theChannelPipeline.<V> io.netty5.util.concurrent.Future<V>newFailedFuture(Throwable cause)<V> io.netty5.util.concurrent.Promise<V>newPromise()io.netty5.util.concurrent.Future<Void>newSucceededFuture()<V> io.netty5.util.concurrent.Future<V>newSucceededFuture(V value)ChannelPipelinepipeline()Return the assignedChannelPipelineChannelHandlerContextread()ChannelHandlerContextread(ReadBufferAllocator readBufferAllocator)Request to read data from theChannel, triggers anChannelHandler.channelRead(ChannelHandlerContext, Object)event if data was read, and triggers achannelReadCompleteevent so the handler can decide to continue reading.io.netty5.util.concurrent.Future<Void>register()Request to register on theEventExecutorfor I/O processing.io.netty5.util.concurrent.Future<Void>sendOutboundEvent(Object event)Send a custom outbound event via thisChannelOutboundInvokerthrough theChannelPipeline.io.netty5.util.concurrent.Future<Void>shutdown(ChannelShutdownDirection direction)Request shutdown one direction of theChanneland notify theFutureonce the operation completes, either because the operation was successful or because of an error.io.netty5.util.concurrent.Future<Void>write(Object msg)Request to write a message via thisChannelHandlerContextthrough theChannelPipeline.io.netty5.util.concurrent.Future<Void>writeAndFlush(Object msg)Shortcut for callChannelOutboundInvoker.write(Object)andChannelOutboundInvoker.flush().
-
-
-
Constructor Detail
-
DelegatingChannelHandlerContext
protected DelegatingChannelHandlerContext(ChannelHandlerContext ctx)
-
-
Method Detail
-
delegatingCtx
public final ChannelHandlerContext delegatingCtx()
-
channel
public Channel channel()
Description copied from interface:ChannelHandlerContextReturn theChannelwhich is bound to theChannelHandlerContext.- Specified by:
channelin interfaceChannelHandlerContext
-
executor
public io.netty5.util.concurrent.EventExecutor executor()
Description copied from interface:ChannelOutboundInvokerReturns theEventExecutorthat is used to execute the operations of thisChannelOutboundInvoker.- Specified by:
executorin interfaceChannelOutboundInvoker- Returns:
- the executor.
-
name
public String name()
Description copied from interface:ChannelHandlerContextThe unique name of theChannelHandlerContext.The name was used when thenChannelHandlerwas added to theChannelPipeline. This name can also be used to access the registeredChannelHandlerfrom theChannelPipeline.- Specified by:
namein interfaceChannelHandlerContext
-
handler
public ChannelHandler handler()
Description copied from interface:ChannelHandlerContextTheChannelHandlerthat is bound thisChannelHandlerContext.- Specified by:
handlerin interfaceChannelHandlerContext
-
isRemoved
public boolean isRemoved()
Description copied from interface:ChannelHandlerContextReturntrueif theChannelHandlerwhich belongs to this context was removed from theChannelPipeline.- Specified by:
isRemovedin interfaceChannelHandlerContext
-
fireChannelRegistered
public ChannelHandlerContext fireChannelRegistered()
Description copied from interface:ChannelInboundInvokerAChannelwas registered to itsEventLoop. This will result in having theChannelHandler.channelRegistered(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelRegisteredin interfaceChannelHandlerContext- Specified by:
fireChannelRegisteredin interfaceChannelInboundInvoker
-
fireChannelUnregistered
public ChannelHandlerContext fireChannelUnregistered()
Description copied from interface:ChannelInboundInvokerAChannelwas unregistered from itsEventLoop. This will result in having theChannelHandler.channelUnregistered(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelUnregisteredin interfaceChannelHandlerContext- Specified by:
fireChannelUnregisteredin interfaceChannelInboundInvoker
-
fireChannelActive
public ChannelHandlerContext fireChannelActive()
Description copied from interface:ChannelInboundInvokerAChannelis active now, which means it is connected. This will result in having theChannelHandler.channelActive(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelActivein interfaceChannelHandlerContext- Specified by:
fireChannelActivein interfaceChannelInboundInvoker
-
fireChannelInactive
public ChannelHandlerContext fireChannelInactive()
Description copied from interface:ChannelInboundInvokerAChannelis inactive now, which means it is closed. This will result in having theChannelHandler.channelInactive(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelInactivein interfaceChannelHandlerContext- Specified by:
fireChannelInactivein interfaceChannelInboundInvoker
-
fireChannelShutdown
public ChannelHandlerContext fireChannelShutdown(ChannelShutdownDirection direction)
Description copied from interface:ChannelInboundInvokerAChannelwas shutdown in a specific direction. This will result in having theChannelHandler.channelShutdown(ChannelHandlerContext, ChannelShutdownDirection)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelShutdownin interfaceChannelHandlerContext- Specified by:
fireChannelShutdownin interfaceChannelInboundInvoker
-
fireChannelExceptionCaught
public ChannelHandlerContext fireChannelExceptionCaught(Throwable cause)
Description copied from interface:ChannelInboundInvokerAChannelreceived anThrowablein one of its inbound operations. This will result in having theChannelHandler.channelExceptionCaught(ChannelHandlerContext, Throwable)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelExceptionCaughtin interfaceChannelHandlerContext- Specified by:
fireChannelExceptionCaughtin interfaceChannelInboundInvoker
-
fireChannelInboundEvent
public ChannelHandlerContext fireChannelInboundEvent(Object evt)
Description copied from interface:ChannelInboundInvokerAChannelreceived a custom defined inbound event. This will result in having theChannelHandler.channelInboundEvent(ChannelHandlerContext, Object)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelInboundEventin interfaceChannelHandlerContext- Specified by:
fireChannelInboundEventin interfaceChannelInboundInvoker
-
fireChannelRead
public ChannelHandlerContext fireChannelRead(Object msg)
Description copied from interface:ChannelInboundInvokerAChannelreceived a message. This will result in having theChannelHandler.channelRead(ChannelHandlerContext, Object)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelReadin interfaceChannelHandlerContext- Specified by:
fireChannelReadin interfaceChannelInboundInvoker
-
fireChannelReadComplete
public ChannelHandlerContext fireChannelReadComplete()
Description copied from interface:ChannelInboundInvokerTriggers anChannelHandler.channelReadComplete(ChannelHandlerContext)event to the nextChannelHandlerin theChannelPipeline.- Specified by:
fireChannelReadCompletein interfaceChannelHandlerContext- Specified by:
fireChannelReadCompletein interfaceChannelInboundInvoker
-
fireChannelWritabilityChanged
public ChannelHandlerContext fireChannelWritabilityChanged()
Description copied from interface:ChannelInboundInvokerTriggers anChannelHandler.channelWritabilityChanged(ChannelHandlerContext)event to the nextChannelHandlerin theChannelPipeline.- Specified by:
fireChannelWritabilityChangedin interfaceChannelHandlerContext- Specified by:
fireChannelWritabilityChangedin interfaceChannelInboundInvoker
-
read
public ChannelHandlerContext read(ReadBufferAllocator readBufferAllocator)
Description copied from interface:ChannelOutboundInvokerRequest to read data from theChannel, triggers anChannelHandler.channelRead(ChannelHandlerContext, Object)event if data was read, and triggers achannelReadCompleteevent 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
ChannelHandler.read(ChannelHandlerContext, ReadBufferAllocator)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
readin interfaceChannelHandlerContext- Specified by:
readin interfaceChannelOutboundInvoker- Parameters:
readBufferAllocator- TheReadBufferAllocatorthat should be used to allocate aBufferif needed (for reading the data).
-
read
public ChannelHandlerContext read()
- Specified by:
readin interfaceChannelHandlerContext- Specified by:
readin interfaceChannelOutboundInvoker- See Also:
(using a default ).
-
flush
public ChannelHandlerContext flush()
Description copied from interface:ChannelOutboundInvokerRequest to flush all pending messages via this ChannelOutboundInvoker.- Specified by:
flushin interfaceChannelHandlerContext- Specified by:
flushin interfaceChannelOutboundInvoker
-
sendOutboundEvent
public io.netty5.util.concurrent.Future<Void> sendOutboundEvent(Object event)
Description copied from interface:ChannelOutboundInvokerSend a custom outbound event via thisChannelOutboundInvokerthrough theChannelPipeline.This will result in having the
ChannelHandler.sendOutboundEvent(ChannelHandlerContext, Object)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
sendOutboundEventin interfaceChannelOutboundInvoker
-
pipeline
public ChannelPipeline pipeline()
Description copied from interface:ChannelHandlerContextReturn the assignedChannelPipeline- Specified by:
pipelinein interfaceChannelHandlerContext
-
bufferAllocator
public io.netty5.buffer.BufferAllocator bufferAllocator()
Description copied from interface:ChannelHandlerContextReturn the assignedBufferAllocatorwhich will be used to allocateBuffers.- Specified by:
bufferAllocatorin interfaceChannelHandlerContext
-
bind
public io.netty5.util.concurrent.Future<Void> bind(SocketAddress localAddress)
Description copied from interface:ChannelOutboundInvokerRequest to bind to the givenSocketAddressand notify theFutureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.bind(ChannelHandlerContext, SocketAddress)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
bindin interfaceChannelOutboundInvoker
-
connect
public io.netty5.util.concurrent.Future<Void> connect(SocketAddress remoteAddress)
Description copied from interface:ChannelOutboundInvokerRequest to connect to the givenSocketAddressand notify theFutureonce the operation completes, either because the operation was successful or because of an error.If the connection fails because of a connection timeout, the
Futurewill get failed with aConnectTimeoutException. If it fails because of connection refused aConnectExceptionwill be used.This will result in having the
ChannelHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
connectin interfaceChannelOutboundInvoker
-
connect
public io.netty5.util.concurrent.Future<Void> connect(SocketAddress remoteAddress, SocketAddress localAddress)
Description copied from interface:ChannelOutboundInvokerRequest to connect to the givenSocketAddresswhile bind to the localAddress and notify theFutureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
connectin interfaceChannelOutboundInvoker
-
disconnect
public io.netty5.util.concurrent.Future<Void> disconnect()
Description copied from interface:ChannelOutboundInvokerRequest to disconnect from the remote peer and notify theFutureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.disconnect(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
disconnectin interfaceChannelOutboundInvoker
-
close
public io.netty5.util.concurrent.Future<Void> close()
Description copied from interface:ChannelOutboundInvokerRequest to close theChanneland notify theFutureonce 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
ChannelHandler.close(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
closein interfaceChannelOutboundInvoker
-
shutdown
public io.netty5.util.concurrent.Future<Void> shutdown(ChannelShutdownDirection direction)
Description copied from interface:ChannelOutboundInvokerRequest shutdown one direction of theChanneland notify theFutureonce the operation completes, either because the operation was successful or because of an error.When completed, the channel will either not produce any inbound data anymore, or it will not be possible to write data anymore, depending on the given
ChannelShutdownDirection.Depending on the transport implementation shutting down the
ChannelShutdownDirection.OutboundorChannelShutdownDirection.Inboundmight also result in data transferred over the network. Like for example in case of TCP shutting down theChannelShutdownDirection.Outboundwill result in aFINthat is transmitted to the remote peer that will as a result shutdownChannelShutdownDirection.Inbound.This will result in having the
ChannelHandler.shutdown(ChannelHandlerContext, ChannelShutdownDirection). method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
shutdownin interfaceChannelOutboundInvoker
-
deregister
public io.netty5.util.concurrent.Future<Void> deregister()
Description copied from interface:ChannelOutboundInvokerRequest to deregister from the previous assignedEventExecutorand notify theFutureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.deregister(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
deregisterin interfaceChannelOutboundInvoker
-
register
public io.netty5.util.concurrent.Future<Void> register()
Description copied from interface:ChannelOutboundInvokerRequest to register on theEventExecutorfor I/O processing.Futureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.register(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
registerin interfaceChannelOutboundInvoker
-
write
public io.netty5.util.concurrent.Future<Void> write(Object msg)
Description copied from interface:ChannelOutboundInvokerRequest to write a message via thisChannelHandlerContextthrough theChannelPipeline. This method will not request to actual flush, so be sure to callChannelOutboundInvoker.flush()once you want to request to flush all pending data to the actual transport.- Specified by:
writein interfaceChannelOutboundInvoker
-
writeAndFlush
public io.netty5.util.concurrent.Future<Void> writeAndFlush(Object msg)
Description copied from interface:ChannelOutboundInvokerShortcut for callChannelOutboundInvoker.write(Object)andChannelOutboundInvoker.flush().- Specified by:
writeAndFlushin interfaceChannelOutboundInvoker
-
newPromise
public <V> io.netty5.util.concurrent.Promise<V> newPromise()
- Specified by:
newPromisein interfaceChannelOutboundInvoker- Specified by:
newPromisein interfaceio.netty5.util.concurrent.FuturePromiseFactory
-
newSucceededFuture
public io.netty5.util.concurrent.Future<Void> newSucceededFuture()
- Specified by:
newSucceededFuturein interfaceChannelOutboundInvoker- Specified by:
newSucceededFuturein interfaceio.netty5.util.concurrent.FuturePromiseFactory
-
newFailedFuture
public <V> io.netty5.util.concurrent.Future<V> newFailedFuture(Throwable cause)
- Specified by:
newFailedFuturein interfaceChannelOutboundInvoker- Specified by:
newFailedFuturein interfaceio.netty5.util.concurrent.FuturePromiseFactory
-
newSucceededFuture
public <V> io.netty5.util.concurrent.Future<V> newSucceededFuture(V value)
- Specified by:
newSucceededFuturein interfaceChannelOutboundInvoker- Specified by:
newSucceededFuturein interfaceio.netty5.util.concurrent.FuturePromiseFactory
-
-