Top Description Inners Fields Constructors Methods
io.netty5.channel

public Class CombinedChannelDuplexHandler<I extends ChannelHandler, O extends ChannelHandler>

extends ChannelHandlerAdapter
Class Inheritance
Imports
io.netty5.channel.internal.DelegatingChannelHandlerContext, io.netty5.util.concurrent.EventExecutor, .Future, java.net.SocketAddress

Combines the inbound handling of one ChannelHandler with the outbound handling of another ChannelHandler.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private volatile boolean
private CombinedChannelDuplexHandler.CombinedChannelHandlerContext
private I
private CombinedChannelDuplexHandler.CombinedChannelHandlerContext
private O
Inherited from io.netty5.channel.ChannelHandlerAdapter:
added

Constructor Summary

AccessConstructor and Description
protected
CombinedChannelDuplexHandler()

Creates a new uninitialized instance.

public
CombinedChannelDuplexHandler(I inboundHandler, O outboundHandler)

Creates a new instance that combines the specified two handlers into one.

Method Summary

Modifier and TypeMethod and Description
public Future<Void>
bind(ChannelHandlerContext
the ChannelHandlerContext for which the bind operation is made
ctx
,
SocketAddress
the SocketAddress to which it should bound
localAddress
)

Overrides default io.netty5.channel.ChannelHandler.bind.

Called once a bind operation is made.
public void
public void
channelExceptionCaught(ChannelHandlerContext ctx, Throwable cause)

Overrides default io.netty5.channel.ChannelHandler.channelExceptionCaught.

Gets called if a Throwable was thrown when handling inbound events.
public void
channelInactive(ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.channelInactive.

The Channel of the ChannelHandlerContext was registered is now inactive and reached its end of lifetime.
public void
channelInboundEvent(ChannelHandlerContext ctx, Object evt)

Overrides default io.netty5.channel.ChannelHandler.channelInboundEvent.

Gets called if a custom inbound event happened.
public void
channelRead(ChannelHandlerContext ctx, Object msg)

Overrides default io.netty5.channel.ChannelHandler.channelRead.

Invoked when the current Channel has read a message from the peer.
public void
channelReadComplete(ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.channelReadComplete.

Invoked when the last message read by the current read operation has been consumed by channelRead(ChannelHandlerContext, Object).
public void
public void
channelShutdown(ChannelHandlerContext
the ChannelHandlerContext for which we notify about the completed shutdown.
ctx
,
ChannelShutdownDirection
the ChannelShutdownDirection of the completed shutdown.
direction
)

Overrides default io.netty5.channel.ChannelHandler.channelShutdown.

The Channel of the ChannelHandlerContext was shutdown in one direction.
public void
public void
channelWritabilityChanged(ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.channelWritabilityChanged.

Gets called once the writable state of a Channel changed.
private void
public Future<Void>
close(ChannelHandlerContext
the ChannelHandlerContext for which the close operation is made
ctx
)

Overrides default io.netty5.channel.ChannelHandler.close.

Called once a close operation is made.
public Future<Void>
connect(ChannelHandlerContext
the ChannelHandlerContext for which the connect operation is made
ctx
,
SocketAddress
the SocketAddress to which it should connect
remoteAddress
,
SocketAddress
the SocketAddress which is used as source on connect
localAddress
)

Overrides default io.netty5.channel.ChannelHandler.connect.

Called once a connect operation is made.
public Future<Void>
deregister(ChannelHandlerContext
the ChannelHandlerContext for which the deregister operation is made
ctx
)

Overrides default io.netty5.channel.ChannelHandler.deregister.

Called once a deregister operation is made from the current registered EventLoop.
public Future<Void>
disconnect(ChannelHandlerContext
the ChannelHandlerContext for which the disconnect operation is made
ctx
)

Overrides default io.netty5.channel.ChannelHandler.disconnect.

Called once a disconnect operation is made.
public void
flush(ChannelHandlerContext
the ChannelHandlerContext for which the flush operation is made
ctx
)

Overrides default io.netty5.channel.ChannelHandler.flush.

Called once a flush operation is made.
public void
handlerAdded(ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.handlerAdded.

Gets called after the ChannelHandler was added to the actual context and it's ready to handle events.
public void
handlerRemoved(ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.handlerRemoved.

Gets called after the ChannelHandler was removed from the actual context and it doesn't handle events anymore.
protected final I
protected final void
init(I inboundHandler, O outboundHandler)

Initialized this handler with the specified handlers.

public final boolean
isSharable()

Overrides default io.netty5.channel.ChannelHandler.isSharable.

Returns true if this handler is sharable and thus can be added to more than one ChannelPipeline.
protected final O
public long
pendingOutboundBytes(ChannelHandlerContext
the ChannelHandlerContext for which the operation is made.
ctx
)

Overrides default io.netty5.channel.ChannelHandler.pendingOutboundBytes.

The number of the outbound bytes that are buffered / queued in this ChannelHandler.
public void
read(ChannelHandlerContext
the ChannelHandlerContext for which the read operation is made
ctx
,
ReadBufferAllocator
The ReadBufferAllocator that should be used to allocate a Buffer if needed (for reading the data).
readBufferAllocator
)

Overrides default io.netty5.channel.ChannelHandler.read.

Called once a read operation is made from the current registered EventLoop.
public Future<Void>
register(ChannelHandlerContext
the ChannelHandlerContext for which the register operation is made
ctx
)

Overrides default io.netty5.channel.ChannelHandler.register.

Called once a register operation is made to register for IO on the EventLoop.
public final void
removeInboundHandler()

Removes the inbound ChannelHandler that was combined in this CombinedChannelDuplexHandler.

public final void
removeOutboundHandler()

Removes the outbound ChannelHandler that was combined in this CombinedChannelDuplexHandler.

public Future<Void>
sendOutboundEvent(ChannelHandlerContext
the ChannelHandlerContext for which the operation is made.
ctx
,
Object
the event.
event
)

Overrides default io.netty5.channel.ChannelHandler.sendOutboundEvent.

Called once a custom defined outbound event was sent.
public Future<Void>
shutdown(ChannelHandlerContext
the ChannelHandlerContext for which the shutdown operation is made
ctx
,
ChannelShutdownDirection
the ChannelShutdownDirection that is used.
direction
)

Overrides default io.netty5.channel.ChannelHandler.shutdown.

Called once a shutdown operation was requested and should be executed.
private void
validate(I inboundHandler, O outboundHandler)

public Future<Void>
write(ChannelHandlerContext
the ChannelHandlerContext for which the write operation is made
ctx
,
Object
the message to write
msg
)

Overrides default io.netty5.channel.ChannelHandler.write.

Called once a write operation is made.

Field Detail

handlerAddedback to summary
private volatile boolean handlerAdded
inboundCtxback to summary
private CombinedChannelDuplexHandler.CombinedChannelHandlerContext inboundCtx
inboundHandlerback to summary
private I inboundHandler
outboundCtxback to summary
private CombinedChannelDuplexHandler.CombinedChannelHandlerContext outboundCtx
outboundHandlerback to summary
private O outboundHandler

Constructor Detail

CombinedChannelDuplexHandlerback to summary
protected CombinedChannelDuplexHandler()

Creates a new uninitialized instance. A class that extends this handler must invoke init(ChannelHandler, ChannelHandler) before adding this handler into a ChannelPipeline.

CombinedChannelDuplexHandlerback to summary
public CombinedChannelDuplexHandler(I inboundHandler, O outboundHandler)

Creates a new instance that combines the specified two handlers into one.

Method Detail

bindback to summary
public Future<Void> bind(ChannelHandlerContext ctx, SocketAddress localAddress)

Overrides default io.netty5.channel.ChannelHandler.bind.

Doc from io.netty5.channel.ChannelHandler.bind.

Called once a bind operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the bind operation is made

localAddress:SocketAddress

the SocketAddress to which it should bound

Returns:Future<Void>

the Future which will be notified once the operation completes.

Annotations
@Override
channelActiveback to summary
public void channelActive(ChannelHandlerContext ctx) throws Exception

Overrides default io.netty5.channel.ChannelHandler.channelActive.

Doc from io.netty5.channel.ChannelHandler.channelActive.

The Channel of the ChannelHandlerContext is now active

Annotations
@Override
channelExceptionCaughtback to summary
public void channelExceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception

Overrides default io.netty5.channel.ChannelHandler.channelExceptionCaught.

Doc from io.netty5.channel.ChannelHandler.channelExceptionCaught.

Gets called if a Throwable was thrown when handling inbound events.

Annotations
@Override
channelInactiveback to summary
public void channelInactive(ChannelHandlerContext ctx) throws Exception

Overrides default io.netty5.channel.ChannelHandler.channelInactive.

Doc from io.netty5.channel.ChannelHandler.channelInactive.

The Channel of the ChannelHandlerContext was registered is now inactive and reached its end of lifetime.

Annotations
@Override
channelInboundEventback to summary
public void channelInboundEvent(ChannelHandlerContext ctx, Object evt) throws Exception

Overrides default io.netty5.channel.ChannelHandler.channelInboundEvent.

Doc from io.netty5.channel.ChannelHandler.channelInboundEvent.

Gets called if a custom inbound event happened.

Annotations
@Override
channelReadback to summary
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception

Overrides default io.netty5.channel.ChannelHandler.channelRead.

Doc from io.netty5.channel.ChannelHandler.channelRead.

Invoked when the current Channel has read a message from the peer.

Annotations
@Override
channelReadCompleteback to summary
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception

Overrides default io.netty5.channel.ChannelHandler.channelReadComplete.

Doc from io.netty5.channel.ChannelHandler.channelReadComplete.

Invoked when the last message read by the current read operation has been consumed by channelRead(ChannelHandlerContext, Object). If ChannelOption#AUTO_READ is off, no further attempt to read an inbound data from the current Channel will be made until ChannelOutboundInvoker#read(ReadBufferAllocator) is called.

Annotations
@Override
channelRegisteredback to summary
public void channelRegistered(ChannelHandlerContext ctx) throws Exception

Overrides default io.netty5.channel.ChannelHandler.channelRegistered.

Doc from io.netty5.channel.ChannelHandler.channelRegistered.

The Channel of the ChannelHandlerContext was registered with its EventLoop

Annotations
@Override
channelShutdownback to summary
public void channelShutdown(ChannelHandlerContext ctx, ChannelShutdownDirection direction) throws Exception

Overrides default io.netty5.channel.ChannelHandler.channelShutdown.

Doc from io.netty5.channel.ChannelHandler.channelShutdown.

The Channel of the ChannelHandlerContext was shutdown in one direction. This might either be because the remote peer did cause a shutdown of one direction or the shutdown was requested explicit by us and was executed.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which we notify about the completed shutdown.

direction:ChannelShutdownDirection

the ChannelShutdownDirection of the completed shutdown.

Annotations
@Override
channelUnregisteredback to summary
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception

Overrides default io.netty5.channel.ChannelHandler.channelUnregistered.

Doc from io.netty5.channel.ChannelHandler.channelUnregistered.

The Channel of the ChannelHandlerContext was unregistered from its EventLoop

Annotations
@Override
channelWritabilityChangedback to summary
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception

Overrides default io.netty5.channel.ChannelHandler.channelWritabilityChanged.

Doc from io.netty5.channel.ChannelHandler.channelWritabilityChanged.

Gets called once the writable state of a Channel changed. You can check the state with Channel#writableBytes() or Channel#isWritable().

Annotations
@Override
checkAddedback to summary
private void checkAdded()
closeback to summary
public Future<Void> close(ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.close.

Doc from io.netty5.channel.ChannelHandler.close.

Called once a close operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the close operation is made

Returns:Future<Void>

the Future which will be notified once the operation completes.

Annotations
@Override
connectback to summary
public Future<Void> connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress)

Overrides default io.netty5.channel.ChannelHandler.connect.

Doc from io.netty5.channel.ChannelHandler.connect.

Called once a connect operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the connect operation is made

remoteAddress:SocketAddress

the SocketAddress to which it should connect

localAddress:SocketAddress

the SocketAddress which is used as source on connect

Returns:Future<Void>

the Future which will be notified once the operation completes.

Annotations
@Override
deregisterback to summary
public Future<Void> deregister(ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.deregister.

Doc from io.netty5.channel.ChannelHandler.deregister.

Called once a deregister operation is made from the current registered EventLoop.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the deregister operation is made

Returns:Future<Void>

the Future which will be notified once the operation completes.

Annotations
@Override
disconnectback to summary
public Future<Void> disconnect(ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.disconnect.

Doc from io.netty5.channel.ChannelHandler.disconnect.

Called once a disconnect operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the disconnect operation is made

Returns:Future<Void>

the Future which will be notified once the operation completes.

Annotations
@Override
flushback to summary
public void flush(ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.flush.

Doc from io.netty5.channel.ChannelHandler.flush.

Called once a flush operation is made. The flush operation will try to flush out all previous written messages that are pending.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the flush operation is made

Annotations
@Override
handlerAddedback to summary
public void handlerAdded(ChannelHandlerContext ctx) throws Exception

Overrides default io.netty5.channel.ChannelHandler.handlerAdded.

Doc from io.netty5.channel.ChannelHandler.handlerAdded.

Gets called after the ChannelHandler was added to the actual context and it's ready to handle events.

Annotations
@Override
handlerRemovedback to summary
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception

Overrides default io.netty5.channel.ChannelHandler.handlerRemoved.

Doc from io.netty5.channel.ChannelHandler.handlerRemoved.

Gets called after the ChannelHandler was removed from the actual context and it doesn't handle events anymore.

Annotations
@Override
inboundHandlerback to summary
protected final I inboundHandler()
initback to summary
protected final void init(I inboundHandler, O outboundHandler)

Initialized this handler with the specified handlers.

Exceptions
IllegalStateException:
if this handler was not constructed via the default constructor or if this handler does not implement all required handler interfaces
IllegalArgumentException:
if the specified handlers cannot be combined into one due to a conflict in the type hierarchy
isSharableback to summary
public final boolean isSharable()

Overrides default io.netty5.channel.ChannelHandler.isSharable.

Doc from io.netty5.channel.ChannelHandler.isSharable.

Returns true if this handler is sharable and thus can be added to more than one ChannelPipeline. By default, this method returns false. If this method returns false, you have to create a new handler instance every time you add it to a pipeline because it has unshared state such as member variables.

Annotations
@Override
outboundHandlerback to summary
protected final O outboundHandler()
pendingOutboundBytesback to summary
public long pendingOutboundBytes(ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.pendingOutboundBytes.

Doc from io.netty5.channel.ChannelHandler.pendingOutboundBytes.

The number of the outbound bytes that are buffered / queued in this ChannelHandler. This number will affect the writability of the Channel together the buffered / queued bytes in the Channel itself. By default this methods returns 0. If the ChannelHandler implementation buffers / queues outbound data this methods should be implemented to return the correct value.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the operation is made.

Returns:long

the number of buffered / queued bytes.

Annotations
@Override
readback to summary
public void read(ChannelHandlerContext ctx, ReadBufferAllocator readBufferAllocator)

Overrides default io.netty5.channel.ChannelHandler.read.

Doc from io.netty5.channel.ChannelHandler.read.

Called once a read operation is made from the current registered EventLoop. If the ChannelHandler implementation queues the read and another read happens it is free to drop the first ReadBufferAllocator and just use the last one.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the read operation is made

readBufferAllocator:ReadBufferAllocator

The ReadBufferAllocator that should be used to allocate a Buffer if needed (for reading the data).

Annotations
@Override
registerback to summary
public Future<Void> register(ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.register.

Doc from io.netty5.channel.ChannelHandler.register.

Called once a register operation is made to register for IO on the EventLoop.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the register operation is made

Returns:Future<Void>

the Future which will be notified once the operation completes.

Annotations
@Override
removeInboundHandlerback to summary
public final void removeInboundHandler()

Removes the inbound ChannelHandler that was combined in this CombinedChannelDuplexHandler.

removeOutboundHandlerback to summary
public final void removeOutboundHandler()

Removes the outbound ChannelHandler that was combined in this CombinedChannelDuplexHandler.

sendOutboundEventback to summary
public Future<Void> sendOutboundEvent(ChannelHandlerContext ctx, Object event)

Overrides default io.netty5.channel.ChannelHandler.sendOutboundEvent.

Doc from io.netty5.channel.ChannelHandler.sendOutboundEvent.

Called once a custom defined outbound event was sent. This operation will pass the event through the ChannelPipeline in the outbound direction.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the operation is made.

event:Object

the event.

Returns:Future<Void>

the Future which will be notified once the operation completes.

Annotations
@Override
shutdownback to summary
public Future<Void> shutdown(ChannelHandlerContext ctx, ChannelShutdownDirection direction)

Overrides default io.netty5.channel.ChannelHandler.shutdown.

Doc from io.netty5.channel.ChannelHandler.shutdown.

Called once a shutdown operation was requested and should be executed.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the shutdown operation is made

direction:ChannelShutdownDirection

the ChannelShutdownDirection that is used.

Returns:Future<Void>

the Future which will be notified once the operation completes.

Annotations
@Override
validateback to summary
private void validate(I inboundHandler, O outboundHandler)
writeback to summary
public Future<Void> write(ChannelHandlerContext ctx, Object msg)

Overrides default io.netty5.channel.ChannelHandler.write.

Doc from io.netty5.channel.ChannelHandler.write.

Called once a write operation is made. The write operation will write the messages through the ChannelPipeline. Those are then ready to be flushed to the actual Channel once Channel#flush() is called.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the write operation is made

msg:Object

the message to write

Returns:Future<Void>

the Future which will be notified once the operation completes.

Annotations
@Override
io.netty5.channel back to summary

private final Class CombinedChannelDuplexHandler.CombinedChannelHandlerContext

extends DelegatingChannelHandlerContext
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final ChannelHandler
pack-priv boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public ChannelHandler
public boolean
pack-priv void
private void
Inherited from io.netty5.channel.internal.DelegatingChannelHandlerContext:
bindbufferAllocatorchannelcloseconnectconnectdelegatingCtxderegisterdisconnectexecutorfireChannelActivefireChannelExceptionCaughtfireChannelInactivefireChannelInboundEventfireChannelReadfireChannelReadCompletefireChannelRegisteredfireChannelShutdownfireChannelUnregisteredfireChannelWritabilityChangedflushnamenewFailedFuturenewPromisenewSucceededFuturenewSucceededFuturepipelinereadreadregistersendOutboundEventshutdownwritewriteAndFlush

Field Detail

handlerback to summary
private final ChannelHandler handler
removedback to summary
pack-priv boolean removed

Constructor Detail

CombinedChannelHandlerContextback to summary
pack-priv CombinedChannelHandlerContext(ChannelHandlerContext ctx, ChannelHandler handler)

Method Detail

handlerback to summary
public ChannelHandler handler()

Overrides io.netty5.channel.internal.DelegatingChannelHandlerContext.handler.

Implements io.netty5.channel.ChannelHandlerContext.handler.

Doc from io.netty5.channel.ChannelHandlerContext.handler.

The ChannelHandler that is bound this ChannelHandlerContext.

Annotations
@Override
isRemovedback to summary
public boolean isRemoved()

Overrides io.netty5.channel.internal.DelegatingChannelHandlerContext.isRemoved.

Implements io.netty5.channel.ChannelHandlerContext.isRemoved.

Doc from io.netty5.channel.ChannelHandlerContext.isRemoved.

Return true if the ChannelHandler which belongs to this context was removed from the ChannelPipeline.

Annotations
@Override
removeback to summary
pack-priv void remove()
remove0back to summary
private void remove0()