-
- All Superinterfaces:
FuturePromiseFactory
- All Known Subinterfaces:
Channel
,ChannelHandlerContext
,ChannelPipeline
,DatagramChannel
,Http2StreamChannel
,ServerChannel
,ServerSocketChannel
,SocketChannel
,UnixChannel
- All Known Implementing Classes:
AbstractChannel
,AbstractChannel.DefaultAbstractChannelPipeline
,AbstractNioByteChannel
,AbstractNioChannel
,AbstractNioMessageChannel
,AbstractServerChannel
,DefaultChannelPipeline
,DelegatingChannelHandlerContext
,EmbeddedChannel
,EpollDatagramChannel
,EpollServerSocketChannel
,EpollSocketChannel
,KQueueDatagramChannel
,KQueueServerSocketChannel
,KQueueSocketChannel
,LocalChannel
,LocalServerChannel
,NioDatagramChannel
,NioServerSocketChannel
,NioSocketChannel
public interface ChannelOutboundInvoker extends FuturePromiseFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Future<Void>
bind(SocketAddress localAddress)
Request to bind to the givenSocketAddress
and notify theFuture
once the operation completes, either because the operation was successful or because of an error.Future<Void>
close()
Future<Void>
connect(SocketAddress remoteAddress)
Request to connect to the givenSocketAddress
and notify theFuture
once the operation completes, either because the operation was successful or because of an error.Future<Void>
connect(SocketAddress remoteAddress, SocketAddress localAddress)
Request to connect to the givenSocketAddress
while bind to the localAddress and notify theFuture
once the operation completes, either because the operation was successful or because of an error.Future<Void>
deregister()
Request to deregister from the previous assignedEventExecutor
and notify theFuture
once the operation completes, either because the operation was successful or because of an error.Future<Void>
disconnect()
Request to disconnect from the remote peer and notify theFuture
once the operation completes, either because the operation was successful or because of an error.EventExecutor
executor()
Returns theEventExecutor
that is used to execute the operations of thisChannelOutboundInvoker
.ChannelOutboundInvoker
flush()
Request to flush all pending messages via this ChannelOutboundInvoker.default <V> Future<V>
newFailedFuture(Throwable cause)
Create a newFuture
which is marked as failed already.default <V> Promise<V>
newPromise()
Return a newPromise
.default Future<Void>
newSucceededFuture()
Create a newFuture
which is marked as succeeded already.default <V> Future<V>
newSucceededFuture(V value)
Create a newFuture
which is marked as succeeded already.ChannelOutboundInvoker
read()
Request to Read data from theChannel
into the first inbound buffer, triggers anChannelHandler.channelRead(ChannelHandlerContext, Object)
event if data was read, and triggers achannelReadComplete
event so the handler can decide to continue reading.Future<Void>
register()
Request to register on theEventExecutor
for I/O processing.Future<Void>
sendOutboundEvent(Object event)
Send a custom outbound event via thisChannelOutboundInvoker
through theChannelPipeline
.Future<Void>
shutdown(ChannelShutdownDirection direction)
Future<Void>
write(Object msg)
Request to write a message via thisChannelHandlerContext
through theChannelPipeline
.Future<Void>
writeAndFlush(Object msg)
Shortcut for callwrite(Object)
andflush()
.
-
-
-
Method Detail
-
bind
Future<Void> bind(SocketAddress localAddress)
Request to bind to the givenSocketAddress
and notify theFuture
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 nextChannelHandler
contained in theChannelPipeline
of theChannel
.
-
connect
Future<Void> connect(SocketAddress remoteAddress)
Request to connect to the givenSocketAddress
and notify theFuture
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 aConnectTimeoutException
. If it fails because of connection refused aConnectException
will be used.This will result in having the
ChannelHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.
-
connect
Future<Void> connect(SocketAddress remoteAddress, SocketAddress localAddress)
Request to connect to the givenSocketAddress
while bind to the localAddress and notify theFuture
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 nextChannelHandler
contained in theChannelPipeline
of theChannel
.
-
disconnect
Future<Void> disconnect()
Request to disconnect from the remote peer and notify theFuture
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 nextChannelHandler
contained in theChannelPipeline
of theChannel
.
-
close
Future<Void> close()
Request to close theChannel
and notify theFuture
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 nextChannelHandler
contained in theChannelPipeline
of theChannel
.
-
shutdown
Future<Void> shutdown(ChannelShutdownDirection direction)
Request shutdown one direction of theChannel
and notify theFuture
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
orChannelShutdownDirection.Inbound
might also result in data transferred over the network. Like for example in case of TCP shutting down theChannelShutdownDirection.Outbound
will result in aFIN
that 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 nextChannelHandler
contained in theChannelPipeline
of theChannel
.
-
register
Future<Void> register()
Request to register on theEventExecutor
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 nextChannelHandler
contained in theChannelPipeline
of theChannel
.
-
deregister
Future<Void> deregister()
Request to deregister from the previous assignedEventExecutor
and notify theFuture
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 nextChannelHandler
contained in theChannelPipeline
of theChannel
.
-
read
ChannelOutboundInvoker read()
Request to Read data from theChannel
into the first inbound buffer, triggers anChannelHandler.channelRead(ChannelHandlerContext, Object)
event if data was read, and triggers achannelReadComplete
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)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.
-
write
Future<Void> write(Object msg)
Request to write a message via thisChannelHandlerContext
through theChannelPipeline
. This method will not request to actual flush, so be sure to callflush()
once you want to request to flush all pending data to the actual transport.
-
flush
ChannelOutboundInvoker flush()
Request to flush all pending messages via this ChannelOutboundInvoker.
-
writeAndFlush
Future<Void> writeAndFlush(Object msg)
Shortcut for callwrite(Object)
andflush()
.
-
sendOutboundEvent
Future<Void> sendOutboundEvent(Object event)
Send a custom outbound event via thisChannelOutboundInvoker
through theChannelPipeline
.This will result in having the
ChannelHandler.sendOutboundEvent(ChannelHandlerContext, Object)
method called of the nextChannelHandler
contained in theChannelPipeline
of theChannel
.
-
newPromise
default <V> Promise<V> newPromise()
Description copied from interface:FuturePromiseFactory
Return a newPromise
.- Specified by:
newPromise
in interfaceFuturePromiseFactory
-
newSucceededFuture
default <V> Future<V> newSucceededFuture(V value)
Description copied from interface:FuturePromiseFactory
Create a newFuture
which is marked as succeeded already. SoAsynchronousResult.isSuccess()
will returntrue
. AllFutureListener
added to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newSucceededFuture
in interfaceFuturePromiseFactory
-
newFailedFuture
default <V> Future<V> newFailedFuture(Throwable cause)
Description copied from interface:FuturePromiseFactory
Create a newFuture
which is marked as failed already. SoAsynchronousResult.isSuccess()
will returnfalse
. AllFutureListener
added to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newFailedFuture
in interfaceFuturePromiseFactory
-
newSucceededFuture
default Future<Void> newSucceededFuture()
Description copied from interface:FuturePromiseFactory
Create a newFuture
which is marked as succeeded already. SoAsynchronousResult.isSuccess()
will returntrue
. AllFutureListener
added to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newSucceededFuture
in interfaceFuturePromiseFactory
-
executor
EventExecutor executor()
Returns theEventExecutor
that is used to execute the operations of thisChannelOutboundInvoker
.- Returns:
- the executor.
-
-