Interface NettyConnectionContext
- All Superinterfaces:
AsyncCloseable
,ConnectionContext
,ConnectionInfo
,ListenableAsyncCloseable
- All Known Subinterfaces:
NettyConnection<Read,
Write>
- All Known Implementing Classes:
DefaultNettyConnection
,NettyPipelinedConnection
ConnectionContext
for netty based transports.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Nested classes/interfaces inherited from interface io.servicetalk.transport.api.ConnectionInfo
ConnectionInfo.Protocol
-
Method Summary
Modifier and TypeMethodDescriptionReturns theFlushStrategy
used by default for thisNettyConnectionContext
.io.netty.channel.Channel
Return the NettyChannel
backing this connection.Returns aCompletable
that is notified when closing begins.updateFlushStrategy
(NettyConnectionContext.FlushStrategyProvider strategyProvider) UpdatesFlushStrategy
associated with this connection.Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefully
Methods inherited from interface io.servicetalk.transport.api.ConnectionContext
parent
Methods inherited from interface io.servicetalk.transport.api.ConnectionInfo
executionContext, localAddress, protocol, remoteAddress, socketOption, sslConfig, sslSession
Methods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose
-
Method Details
-
updateFlushStrategy
UpdatesFlushStrategy
associated with this connection. UpdatedFlushStrategy
will be used in any subsequent writes on this connection.- Parameters:
strategyProvider
-NettyConnectionContext.FlushStrategyProvider
to provide a newFlushStrategy
.NettyConnectionContext.FlushStrategyProvider.computeFlushStrategy(FlushStrategy, boolean)
MAY be invoked multiple times for a single call to this method and is expected to be idempotent.- Returns:
- A
Cancellable
that will cancel this update.
-
defaultFlushStrategy
FlushStrategy defaultFlushStrategy()Returns theFlushStrategy
used by default for thisNettyConnectionContext
.- Returns:
- The
FlushStrategy
used by default for thisNettyConnectionContext
.
-
transportError
Returns aSingle
<Throwable
> that may terminate with an error, if an error is observed at the transport.Note:The
Single
is not required to be blocking-safe and should be offloaded if theSingleSource.Subscriber
may block. -
onClosing
Completable onClosing()Description copied from interface:ListenableAsyncCloseable
Returns aCompletable
that is notified when closing begins.Closing begin might be when a close operation is initiated locally (e.g. subscribing to
AsyncCloseable.closeAsync()
) or it could also be a transport event received from a remote peer (e.g. read aconnection: close
header).For backwards compatibility this method maybe functionally equivalent to
ListenableAsyncCloseable.onClose()
. Therefore, provides a best-effort leading edge notification of closing, but may fall back to notification on trailing edge.The goal of this method is often to notify asap when closing so this method may not be offloaded and care must be taken to avoid blocking if subscribing to the return
Completable
.- Specified by:
onClosing
in interfaceListenableAsyncCloseable
- Returns:
- a
Completable
that is notified when closing begins.
-
nettyChannel
io.netty.channel.Channel nettyChannel()Return the NettyChannel
backing this connection.- Returns:
- the Netty
Channel
backing this connection.
-