Top Methods
io.netty5.channel

public Interface ChannelOutboundInvoker

extends FuturePromiseFactory
Known Direct Subinterfaces
io.netty5.channel.ChannelPipeline, io.netty5.channel.Channel, io.netty5.channel.ChannelHandlerContext
Imports
io.netty5.buffer.Buffer, io.netty5.util.concurrent.EventExecutor, .Future, .FuturePromiseFactory, .Promise, java.net.ConnectException, .SocketAddress

Method Summary

Modifier and TypeMethod and Description
public Future<Void>
bind(SocketAddress localAddress)

Request to bind to the given SocketAddress and notify the Future once the operation completes, either because the operation was successful or because of an error.

public Future<Void>
close()

Request to close the Channel and notify the Future once the operation completes, either because the operation was successful or because of an error.

public Future<Void>
connect(SocketAddress remoteAddress)

Request to connect to the given SocketAddress and notify the Future once the operation completes, either because the operation was successful or because of an error.

public Future<Void>
connect(SocketAddress remoteAddress, SocketAddress localAddress)

Request to connect to the given SocketAddress while bind to the localAddress and notify the Future once the operation completes, either because the operation was successful or because of an error.

public Future<Void>
deregister()

Request to deregister from the previous assigned EventExecutor and notify the Future once the operation completes, either because the operation was successful or because of an error.

public Future<Void>
disconnect()

Request to disconnect from the remote peer and notify the Future once the operation completes, either because the operation was successful or because of an error.

public EventExecutor

Returns:

the executor.
executor
()

Returns the EventExecutor that is used to execute the operations of this ChannelOutboundInvoker.

public ChannelOutboundInvoker
flush()

Request to flush all pending messages via this ChannelOutboundInvoker.

public default <V> Future<V>
newFailedFuture(Throwable cause)

Overrides default io.netty5.util.concurrent.FuturePromiseFactory.newFailedFuture.

Create a new Future which is marked as failed already.
public default <V> Promise<V>
public default <V> Future<V>
newSucceededFuture(V value)

Overrides default io.netty5.util.concurrent.FuturePromiseFactory.newSucceededFuture.

Create a new Future which is marked as succeeded already.
public default Future<Void>
newSucceededFuture()

Overrides default io.netty5.util.concurrent.FuturePromiseFactory.newSucceededFuture.

Create a new Future which is marked as succeeded already.
public ChannelOutboundInvoker
read(ReadBufferAllocator
The ReadBufferAllocator that should be used to allocate a Buffer if needed (for reading the data).
readBufferAllocator
)

Request to read data from the Channel, triggers an ChannelHandler#channelRead(ChannelHandlerContext, Object) event if data was read, and triggers a channelReadComplete event so the handler can decide to continue reading.

public ChannelOutboundInvoker
read()

public Future<Void>
register()

Request to register on the EventExecutor for I/O processing.

public Future<Void>
sendOutboundEvent(Object event)

Send a custom outbound event via this ChannelOutboundInvoker through the ChannelPipeline.

public Future<Void>
shutdown(ChannelShutdownDirection direction)

Request shutdown one direction of the Channel and notify the Future once the operation completes, either because the operation was successful or because of an error.

public Future<Void>
write(Object msg)

Request to write a message via this ChannelHandlerContext through the ChannelPipeline.

public Future<Void>
writeAndFlush(Object msg)

Shortcut for call write(Object) and flush().

Method Detail

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

Request to bind to the given SocketAddress and notify the Future once 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 next ChannelHandler contained in the ChannelPipeline of the Channel.

closeback to summary
public Future<Void> close()

Request to close the Channel and notify the Future 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 ChannelHandler#close(ChannelHandlerContext) method called of the next ChannelHandler contained in the ChannelPipeline of the Channel.

connectback to summary
public Future<Void> connect(SocketAddress remoteAddress)

Request to connect to the given SocketAddress and notify the Future 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 Future will get failed with a ConnectTimeoutException. If it fails because of connection refused a ConnectException will be used.

This will result in having the ChannelHandler#connect(ChannelHandlerContext, SocketAddress, SocketAddress) method called of the next ChannelHandler contained in the ChannelPipeline of the Channel.

connectback to summary
public Future<Void> connect(SocketAddress remoteAddress, SocketAddress localAddress)

Request to connect to the given SocketAddress while bind to the localAddress and notify the Future once 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 next ChannelHandler contained in the ChannelPipeline of the Channel.

deregisterback to summary
public Future<Void> deregister()

Request to deregister from the previous assigned EventExecutor and notify the Future once 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 next ChannelHandler contained in the ChannelPipeline of the Channel.

disconnectback to summary
public Future<Void> disconnect()

Request to disconnect from the remote peer and notify the Future once 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 next ChannelHandler contained in the ChannelPipeline of the Channel.

executorback to summary
public EventExecutor executor()

Returns the EventExecutor that is used to execute the operations of this ChannelOutboundInvoker.

Returns:EventExecutor

the executor.

flushback to summary
public ChannelOutboundInvoker flush()

Request to flush all pending messages via this ChannelOutboundInvoker.

newFailedFutureback to summary
public default <V> Future<V> newFailedFuture(Throwable cause)

Overrides default io.netty5.util.concurrent.FuturePromiseFactory.newFailedFuture.

Doc from io.netty5.util.concurrent.FuturePromiseFactory.newFailedFuture.

Create a new Future 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.

Annotations
@Override
newPromiseback to summary
public default <V> Promise<V> newPromise()

Implements io.netty5.util.concurrent.FuturePromiseFactory.newPromise.

Doc from io.netty5.util.concurrent.FuturePromiseFactory.newPromise.

Return a new Promise.

Annotations
@Override
newSucceededFutureback to summary
public default <V> Future<V> newSucceededFuture(V value)

Overrides default io.netty5.util.concurrent.FuturePromiseFactory.newSucceededFuture.

Doc from io.netty5.util.concurrent.FuturePromiseFactory.newSucceededFuture.

Create a new Future 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.

Annotations
@Override
newSucceededFutureback to summary
public default Future<Void> newSucceededFuture()

Overrides default io.netty5.util.concurrent.FuturePromiseFactory.newSucceededFuture.

Doc from io.netty5.util.concurrent.FuturePromiseFactory.newSucceededFuture.

Create a new Future 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.

Annotations
@Override
readback to summary
public ChannelOutboundInvoker read(ReadBufferAllocator readBufferAllocator)

Request to read data from the Channel, triggers an ChannelHandler#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 ChannelHandler#read(ChannelHandlerContext, ReadBufferAllocator) method called of the next ChannelHandler contained in the ChannelPipeline of the Channel.

Parameters
readBufferAllocator:ReadBufferAllocator

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

readback to summary
public ChannelOutboundInvoker read()
See Also
(using a default <a href="io.netty5.channel.ReadBufferAllocator.html" class="jlink"><code class="coderef">ReadBufferAllocator</code></a>).
registerback to summary
public Future<Void> register()

Request to register on the EventExecutor for I/O processing. Future once 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 next ChannelHandler contained in the ChannelPipeline of the Channel.

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

Send a custom outbound event via this ChannelOutboundInvoker through the ChannelPipeline.

This will result in having the ChannelHandler#sendOutboundEvent(ChannelHandlerContext, Object) method called of the next ChannelHandler contained in the ChannelPipeline of the Channel.

shutdownback to summary
public Future<Void> shutdown(ChannelShutdownDirection direction)

Request shutdown one direction of the Channel and notify the Future once 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#Outbound or ChannelShutdownDirection#Inbound might also result in data transferred over the network. Like for example in case of TCP shutting down the ChannelShutdownDirection#Outbound will result in a FIN that is transmitted to the remote peer that will as a result shutdown ChannelShutdownDirection#Inbound.

This will result in having the ChannelHandler#shutdown(ChannelHandlerContext, ChannelShutdownDirection). method called of the next ChannelHandler contained in the ChannelPipeline of the Channel.

writeback to summary
public Future<Void> write(Object msg)

Request to write a message via this ChannelHandlerContext through the ChannelPipeline. This method will not request to actual flush, so be sure to call flush() once you want to request to flush all pending data to the actual transport.

writeAndFlushback to summary
public Future<Void> writeAndFlush(Object msg)

Shortcut for call write(Object) and flush().