Class DefaultNettyConnection<Read,Write>
java.lang.Object
io.servicetalk.transport.netty.internal.NettyChannelListenableAsyncCloseable
io.servicetalk.transport.netty.internal.DefaultNettyConnection<Read,Write>
- Type Parameters:
Read
- Type of objects read from this connection.Write
- Type of objects written to this connection.
- All Implemented Interfaces:
AsyncCloseable
,ListenableAsyncCloseable
,ConnectionContext
,ConnectionInfo
,NettyConnection<Read,
,Write> NettyConnectionContext
public final class DefaultNettyConnection<Read,Write>
extends NettyChannelListenableAsyncCloseable
implements NettyConnection<Read,Write>
Implementation of
NettyConnection
backed by a netty Channel
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Netty UserEvent to signal cancellation of the write stream.static final class
Netty UserEvent to signal continuation.Nested classes/interfaces inherited from interface io.servicetalk.transport.api.ConnectionInfo
ConnectionInfo.Protocol
Nested classes/interfaces inherited from interface io.servicetalk.transport.netty.internal.NettyConnectionContext
NettyConnectionContext.FlushStrategyProvider
-
Method Summary
Modifier and TypeMethodDescriptionvoid
channelClosed
(Throwable closedException) void
void
void
Returns theFlushStrategy
used by default for thisNettyConnectionContext
.protected void
Initiate graceful closure.Get theExecutionContext
for thisConnectionInfo
.static <Read,
Write>
Single<DefaultNettyConnection<Read,Write>> initChannel
(io.netty.channel.Channel channel, BufferAllocator allocator, Executor executor, IoExecutor ioExecutor, CloseHandler closeHandler, FlushStrategy flushStrategy, long idleTimeoutMs, SslConfig sslConfig, ChannelInitializer initializer, ExecutionStrategy executionStrategy, ConnectionInfo.Protocol protocol, ConnectionObserver observer, boolean isClient, Predicate<Object> shouldWait) Deprecated.static <Read,
Write>
Single<DefaultNettyConnection<Read,Write>> initChannel
(io.netty.channel.Channel channel, BufferAllocator allocator, Executor executor, IoExecutor ioExecutor, CloseHandler closeHandler, FlushStrategy flushStrategy, Long idleTimeoutMs, ChannelInitializer initializer, ExecutionStrategy executionStrategy, ConnectionInfo.Protocol protocol, ConnectionObserver observer, boolean isClient) Deprecated.Use#initChannel(Channel, ExecutionContext, CloseHandler, FlushStrategy, long, SslConfig, ChannelInitializer, Protocol, ConnectionObserver, boolean, Predicate)
.static <Read,
Write>
Single<DefaultNettyConnection<Read,Write>> initChannel
(io.netty.channel.Channel channel, BufferAllocator allocator, Executor executor, IoExecutor ioExecutor, CloseHandler closeHandler, FlushStrategy flushStrategy, Long idleTimeoutMs, ChannelInitializer initializer, ExecutionStrategy executionStrategy, ConnectionInfo.Protocol protocol, ConnectionObserver observer, boolean isClient, Predicate<Object> shouldWait) Deprecated.Use#initChannel(Channel, ExecutionContext, CloseHandler, FlushStrategy, long, SslConfig, ChannelInitializer, Protocol, ConnectionObserver, boolean, Predicate)
.static <Read,
Write>
Single<DefaultNettyConnection<Read,Write>> initChannel
(io.netty.channel.Channel channel, ExecutionContext<?> executionContext, CloseHandler closeHandler, FlushStrategy flushStrategy, long idleTimeoutMs, SslConfig sslConfig, ChannelInitializer initializer, ConnectionInfo.Protocol protocol, ConnectionObserver observer, boolean isClient, Predicate<Object> shouldWait) static <Read,
Write>
DefaultNettyConnection<Read,Write> initChildChannel
(io.netty.channel.Channel channel, ConnectionContext parent, CloseHandler closeHandler, FlushStrategy flushStrategy, long idleTimeoutMs, ConnectionInfo.Protocol protocol, io.netty.channel.ChannelConfig parentChannelConfig, ConnectionObserver.StreamObserver streamObserver, boolean isClient, Predicate<Object> shouldWait, UnaryOperator<Throwable> enrichProtocolError) static <Read,
Write>
DefaultNettyConnection<Read,Write> initChildChannel
(io.netty.channel.Channel channel, ExecutionContext<?> executionContext, CloseHandler closeHandler, FlushStrategy flushStrategy, long idleTimeoutMs, ConnectionInfo.Protocol protocol, SslConfig sslConfig, SSLSession sslSession, io.netty.channel.ChannelConfig parentChannelConfig, ConnectionObserver.StreamObserver streamObserver, boolean isClient, Predicate<Object> shouldWait, UnaryOperator<Throwable> enrichProtocolError) Deprecated.Use#initChildChannel(Channel, ConnectionContext, CloseHandler, FlushStrategy, long, Protocol, ChannelConfig, StreamObserver, boolean, Predicate, UnaryOperator)
.static <Read,
Write>
DefaultNettyConnection<Read,Write> initChildChannel
(io.netty.channel.Channel channel, ExecutionContext<?> executionContext, CloseHandler closeHandler, FlushStrategy flushStrategy, Long idleTimeoutMs, ConnectionInfo.Protocol protocol, SSLSession sslSession, io.netty.channel.ChannelConfig parentChannelConfig, ConnectionObserver.StreamObserver streamObserver, boolean isClient, Predicate<Object> shouldWait, UnaryOperator<Throwable> enrichProtocolError) Deprecated.Use#initChildChannel(Channel, ConnectionContext, CloseHandler, FlushStrategy, long, Protocol, ChannelConfig, StreamObserver, boolean, Predicate, UnaryOperator)
.static <Read,
Write>
DefaultNettyConnection<Read,Write> initChildChannel
(io.netty.channel.Channel channel, ExecutionContext<?> executionContext, CloseHandler closeHandler, FlushStrategy flushStrategy, Long idleTimeoutMs, ConnectionInfo.Protocol protocol, SSLSession sslSession, io.netty.channel.ChannelConfig parentChannelConfig, ConnectionObserver.StreamObserver streamObserver, boolean isClient, UnaryOperator<Throwable> enrichProtocolError) Deprecated.Use#initChildChannel(Channel, ConnectionContext, CloseHandler, FlushStrategy, long, Protocol, ChannelConfig, StreamObserver, boolean, Predicate, UnaryOperator)
.void
listenerDiscard
(Throwable cause) TheSocketAddress
to which the associated connection is bound.io.netty.channel.Channel
Return the NettyChannel
backing this connection.parent()
Returns a reference to a parentConnectionContext
if any.protocol()
Get theConnectionInfo.Protocol
for thisConnectionInfo
.read()
ReturnsPublisher
that emits all items as read from this connection.TheSocketAddress
to which the associated connection is connected.<T> T
socketOption
(SocketOption<T> option) Get theSslConfig
for this connection.Get theSSLSession
for this connection.void
toString()
updateFlushStrategy
(NettyConnectionContext.FlushStrategyProvider strategyProvider) UpdatesFlushStrategy
associated with this connection.Writes all elements emitted by the passedPublisher
on this connection.write
(Publisher<Write> write, Supplier<FlushStrategy> flushStrategySupplier, Supplier<WriteDemandEstimator> demandEstimatorSupplier) Writes all elements emitted by the passedPublisher
on this connection.Methods inherited from class io.servicetalk.transport.netty.internal.NettyChannelListenableAsyncCloseable
channel, closeAsync, closeAsyncGracefully, closeAsyncGracefullyNoOffload, closeAsyncNoOffload, notifyOnClosing, onClose, onClosing
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefully
Methods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose
Methods inherited from interface io.servicetalk.transport.netty.internal.NettyConnectionContext
onClosing
-
Method Details
-
initChildChannel
@Deprecated public static <Read,Write> DefaultNettyConnection<Read,Write> initChildChannel(io.netty.channel.Channel channel, ExecutionContext<?> executionContext, CloseHandler closeHandler, FlushStrategy flushStrategy, Long idleTimeoutMs, ConnectionInfo.Protocol protocol, @Nullable SSLSession sslSession, @Nullable io.netty.channel.ChannelConfig parentChannelConfig, ConnectionObserver.StreamObserver streamObserver, boolean isClient, UnaryOperator<Throwable> enrichProtocolError) Deprecated.Use#initChildChannel(Channel, ConnectionContext, CloseHandler, FlushStrategy, long, Protocol, ChannelConfig, StreamObserver, boolean, Predicate, UnaryOperator)
.Given aChannel
this will initialize theChannelPipeline
just to create aDefaultNettyConnection
. It is assumed this is a child channel and all TLS handshaking is completed.- Type Parameters:
Read
- Type of objects read from theNettyConnection
.Write
- Type of objects written to theNettyConnection
.- Parameters:
channel
- A newly createdChannel
.executionContext
- Used to derive theexecutionContext()
.closeHandler
- Manages the half closure of theDefaultNettyConnection
.flushStrategy
- Manages flushing of data for theDefaultNettyConnection
.idleTimeoutMs
- Value forIDLE_TIMEOUT
socket option.protocol
-ConnectionInfo.Protocol
for the returnedDefaultNettyConnection
.sslSession
- Provides access to theSSLSession
associated with this connection.parentChannelConfig
-ChannelConfig
of the parentChannel
to querySocketOption
s.streamObserver
-ConnectionObserver.StreamObserver
to report internal events.isClient
- tells if thisChannel
is for the client.enrichProtocolError
- enriches protocol-specificThrowable
s.- Returns:
- A
Single
that completes with aDefaultNettyConnection
after the channel is activated and ready to use.
-
initChildChannel
@Deprecated public static <Read,Write> DefaultNettyConnection<Read,Write> initChildChannel(io.netty.channel.Channel channel, ExecutionContext<?> executionContext, CloseHandler closeHandler, FlushStrategy flushStrategy, Long idleTimeoutMs, ConnectionInfo.Protocol protocol, @Nullable SSLSession sslSession, @Nullable io.netty.channel.ChannelConfig parentChannelConfig, ConnectionObserver.StreamObserver streamObserver, boolean isClient, Predicate<Object> shouldWait, UnaryOperator<Throwable> enrichProtocolError) Deprecated.Use#initChildChannel(Channel, ConnectionContext, CloseHandler, FlushStrategy, long, Protocol, ChannelConfig, StreamObserver, boolean, Predicate, UnaryOperator)
.Given aChannel
this will initialize theChannelPipeline
just to create aDefaultNettyConnection
. It is assumed this is a child channel and all TLS handshaking is completed.- Type Parameters:
Read
- Type of objects read from theNettyConnection
.Write
- Type of objects written to theNettyConnection
.- Parameters:
channel
- A newly createdChannel
.executionContext
- Used to derive theexecutionContext()
.closeHandler
- Manages the half closure of theDefaultNettyConnection
.flushStrategy
- Manages flushing of data for theDefaultNettyConnection
.idleTimeoutMs
- Value forIDLE_TIMEOUT
socket option.protocol
-ConnectionInfo.Protocol
for the returnedDefaultNettyConnection
.sslSession
- Provides access to theSSLSession
associated with this connection.parentChannelConfig
-ChannelConfig
of the parentChannel
to querySocketOption
s.streamObserver
-ConnectionObserver.StreamObserver
to report internal events.isClient
- tells if thisChannel
is for the client.shouldWait
- predicate that tells when request payload body should wait for continuation signal.enrichProtocolError
- enriches protocol-specificThrowable
s.- Returns:
- A
Single
that completes with aDefaultNettyConnection
after the channel is activated and ready to use.
-
initChildChannel
@Deprecated public static <Read,Write> DefaultNettyConnection<Read,Write> initChildChannel(io.netty.channel.Channel channel, ExecutionContext<?> executionContext, CloseHandler closeHandler, FlushStrategy flushStrategy, long idleTimeoutMs, ConnectionInfo.Protocol protocol, @Nullable SslConfig sslConfig, @Nullable SSLSession sslSession, @Nullable io.netty.channel.ChannelConfig parentChannelConfig, ConnectionObserver.StreamObserver streamObserver, boolean isClient, Predicate<Object> shouldWait, UnaryOperator<Throwable> enrichProtocolError) Deprecated.Use#initChildChannel(Channel, ConnectionContext, CloseHandler, FlushStrategy, long, Protocol, ChannelConfig, StreamObserver, boolean, Predicate, UnaryOperator)
.Given aChannel
this will initialize theChannelPipeline
just to create aDefaultNettyConnection
. It is assumed this is a child channel and all TLS handshaking is completed.- Type Parameters:
Read
- Type of objects read from theNettyConnection
.Write
- Type of objects written to theNettyConnection
.- Parameters:
channel
- A newly createdChannel
.executionContext
- Used to derive theexecutionContext()
.closeHandler
- Manages the half closure of theDefaultNettyConnection
.flushStrategy
- Manages flushing of data for theDefaultNettyConnection
.idleTimeoutMs
- Value forIDLE_TIMEOUT
socket option.protocol
-ConnectionInfo.Protocol
for the returnedDefaultNettyConnection
.sslConfig
- TheSslConfig
to use for theDefaultNettyConnection
.sslSession
- Provides access to theSSLSession
associated with this connection.parentChannelConfig
-ChannelConfig
of the parentChannel
to querySocketOption
s.streamObserver
-ConnectionObserver.StreamObserver
to report internal events.isClient
- tells if thisChannel
is for the client.shouldWait
- predicate that tells when request payload body should wait for continuation signal.enrichProtocolError
- enriches protocol-specificThrowable
s.- Returns:
- A
Single
that completes with aDefaultNettyConnection
after the channel is activated and ready to use.
-
initChildChannel
public static <Read,Write> DefaultNettyConnection<Read,Write> initChildChannel(io.netty.channel.Channel channel, ConnectionContext parent, CloseHandler closeHandler, FlushStrategy flushStrategy, long idleTimeoutMs, ConnectionInfo.Protocol protocol, @Nullable io.netty.channel.ChannelConfig parentChannelConfig, ConnectionObserver.StreamObserver streamObserver, boolean isClient, Predicate<Object> shouldWait, UnaryOperator<Throwable> enrichProtocolError) Given aChannel
this will initialize theChannelPipeline
just to create aDefaultNettyConnection
. It is assumed this is a child channel and all TLS handshaking is completed.- Type Parameters:
Read
- Type of objects read from theNettyConnection
.Write
- Type of objects written to theNettyConnection
.- Parameters:
channel
- A newly createdChannel
.parent
- The parent context asNettyConnectionContext
.closeHandler
- Manages the half closure of theDefaultNettyConnection
.flushStrategy
- Manages flushing of data for theDefaultNettyConnection
.idleTimeoutMs
- Value forIDLE_TIMEOUT
socket option.protocol
-ConnectionInfo.Protocol
for the returnedDefaultNettyConnection
.parentChannelConfig
-ChannelConfig
of the parentChannel
to querySocketOption
s.streamObserver
-ConnectionObserver.StreamObserver
to report internal events.isClient
- tells if thisChannel
is for the client.shouldWait
- predicate that tells when request payload body should wait for continuation signal.enrichProtocolError
- enriches protocol-specificThrowable
s.- Returns:
- A
Single
that completes with aDefaultNettyConnection
after the channel is activated and ready to use.
-
initChannel
@Deprecated public static <Read,Write> Single<DefaultNettyConnection<Read,Write>> initChannel(io.netty.channel.Channel channel, BufferAllocator allocator, Executor executor, @Nullable IoExecutor ioExecutor, CloseHandler closeHandler, FlushStrategy flushStrategy, Long idleTimeoutMs, ChannelInitializer initializer, ExecutionStrategy executionStrategy, ConnectionInfo.Protocol protocol, ConnectionObserver observer, boolean isClient) Deprecated.Use#initChannel(Channel, ExecutionContext, CloseHandler, FlushStrategy, long, SslConfig, ChannelInitializer, Protocol, ConnectionObserver, boolean, Predicate)
.Given aChannel
this will initialize theChannelPipeline
and create aDefaultNettyConnection
. The resulting single will complete after the TLS handshake has completed (if applicable) or otherwise after the channel is active and ready to use.- Type Parameters:
Read
- Type of objects read from theNettyConnection
.Write
- Type of objects written to theNettyConnection
.- Parameters:
channel
- A newly createdChannel
.allocator
- TheBufferAllocator
to use for theDefaultNettyConnection
.executor
- TheExecutor
to use for theDefaultNettyConnection
.ioExecutor
- TheIoExecutor
to use for theDefaultNettyConnection
.closeHandler
- Manages the half closure of theDefaultNettyConnection
.flushStrategy
- Manages flushing of data for theDefaultNettyConnection
.idleTimeoutMs
- Value forIDLE_TIMEOUT
socket option.initializer
- Synchronously initializes the pipeline upon subscribe.executionStrategy
-ExecutionStrategy
to use for this connection.protocol
-ConnectionInfo.Protocol
for the returnedDefaultNettyConnection
.observer
-ConnectionObserver
to report network events.isClient
- tells if thisChannel
is for the client.- Returns:
- A
Single
that completes with aDefaultNettyConnection
after the channel is activated and ready to use.
-
initChannel
@Deprecated public static <Read,Write> Single<DefaultNettyConnection<Read,Write>> initChannel(io.netty.channel.Channel channel, BufferAllocator allocator, Executor executor, @Nullable IoExecutor ioExecutor, CloseHandler closeHandler, FlushStrategy flushStrategy, Long idleTimeoutMs, ChannelInitializer initializer, ExecutionStrategy executionStrategy, ConnectionInfo.Protocol protocol, ConnectionObserver observer, boolean isClient, Predicate<Object> shouldWait) Deprecated.Use#initChannel(Channel, ExecutionContext, CloseHandler, FlushStrategy, long, SslConfig, ChannelInitializer, Protocol, ConnectionObserver, boolean, Predicate)
.Given aChannel
this will initialize theChannelPipeline
and create aDefaultNettyConnection
. The resulting single will complete after the TLS handshake has completed (if applicable) or otherwise after the channel is active and ready to use.- Type Parameters:
Read
- Type of objects read from theNettyConnection
.Write
- Type of objects written to theNettyConnection
.- Parameters:
channel
- A newly createdChannel
.allocator
- TheBufferAllocator
to use for theDefaultNettyConnection
.executor
- TheExecutor
to use for theDefaultNettyConnection
.ioExecutor
- TheIoExecutor
to use for theDefaultNettyConnection
.closeHandler
- Manages the half closure of theDefaultNettyConnection
.flushStrategy
- Manages flushing of data for theDefaultNettyConnection
.idleTimeoutMs
- Value forIDLE_TIMEOUT
socket option.initializer
- Synchronously initializes the pipeline upon subscribe.executionStrategy
-ExecutionStrategy
to use for this connection.protocol
-ConnectionInfo.Protocol
for the returnedDefaultNettyConnection
.observer
-ConnectionObserver
to report network events.isClient
- tells if thisChannel
is for the client.shouldWait
- predicate that tells when request payload body should wait for continuation signal.- Returns:
- A
Single
that completes with aDefaultNettyConnection
after the channel is activated and ready to use.
-
initChannel
@Deprecated public static <Read,Write> Single<DefaultNettyConnection<Read,Write>> initChannel(io.netty.channel.Channel channel, BufferAllocator allocator, Executor executor, @Nullable IoExecutor ioExecutor, CloseHandler closeHandler, FlushStrategy flushStrategy, long idleTimeoutMs, @Nullable SslConfig sslConfig, ChannelInitializer initializer, ExecutionStrategy executionStrategy, ConnectionInfo.Protocol protocol, ConnectionObserver observer, boolean isClient, Predicate<Object> shouldWait) Deprecated.Use#initChannel(Channel, ExecutionContext, CloseHandler, FlushStrategy, long, SslConfig, ChannelInitializer, Protocol, ConnectionObserver, boolean, Predicate)
.Given aChannel
this will initialize theChannelPipeline
and create aDefaultNettyConnection
. The resulting single will complete after the TLS handshake has completed (if applicable) or otherwise after the channel is active and ready to use.- Type Parameters:
Read
- Type of objects read from theNettyConnection
.Write
- Type of objects written to theNettyConnection
.- Parameters:
channel
- A newly createdChannel
.allocator
- TheBufferAllocator
to use for theDefaultNettyConnection
.executor
- TheExecutor
to use for theDefaultNettyConnection
.ioExecutor
- TheIoExecutor
to use for theDefaultNettyConnection
.closeHandler
- Manages the half closure of theDefaultNettyConnection
.flushStrategy
- Manages flushing of data for theDefaultNettyConnection
.idleTimeoutMs
- Value forIDLE_TIMEOUT
socket option.sslConfig
- TheSslConfig
to use for theDefaultNettyConnection
.initializer
- Synchronously initializes the pipeline upon subscribe.executionStrategy
-ExecutionStrategy
to use for this connection.protocol
-ConnectionInfo.Protocol
for the returnedDefaultNettyConnection
.observer
-ConnectionObserver
to report network events.isClient
- tells if thisChannel
is for the client.shouldWait
- predicate that tells when request payload body should wait for continuation signal.- Returns:
- A
Single
that completes with aDefaultNettyConnection
after the channel is activated and ready to use.
-
initChannel
public static <Read,Write> Single<DefaultNettyConnection<Read,Write>> initChannel(io.netty.channel.Channel channel, ExecutionContext<?> executionContext, CloseHandler closeHandler, FlushStrategy flushStrategy, long idleTimeoutMs, @Nullable SslConfig sslConfig, ChannelInitializer initializer, ConnectionInfo.Protocol protocol, ConnectionObserver observer, boolean isClient, Predicate<Object> shouldWait) Given aChannel
this will initialize theChannelPipeline
and create aDefaultNettyConnection
. The resulting single will complete after the TLS handshake has completed (if applicable) or otherwise after the channel is active and ready to use.- Type Parameters:
Read
- Type of objects read from theNettyConnection
.Write
- Type of objects written to theNettyConnection
.- Parameters:
channel
- A newly createdChannel
.executionContext
- TheExecutionContext
to use for theDefaultNettyConnection
. Note:ExecutionContext.ioExecutor()
must be backed by a singleEventLoop
thread identical toChannel.eventLoop()
for the specified channel.closeHandler
- Manages the half closure of theDefaultNettyConnection
.flushStrategy
- Manages flushing of data for theDefaultNettyConnection
.idleTimeoutMs
- Value forIDLE_TIMEOUT
socket option.sslConfig
- TheSslConfig
to use for theDefaultNettyConnection
.initializer
- Synchronously initializes the pipeline upon subscribe.protocol
-ConnectionInfo.Protocol
for the returnedDefaultNettyConnection
.observer
-ConnectionObserver
to report network events.isClient
- tells if thisChannel
is for the client.shouldWait
- predicate that tells when request payload body should wait for continuation signal.- Returns:
- A
Single
that completes with aDefaultNettyConnection
after the channel is activated and ready to use.
-
read
Description copied from interface:NettyConnection
ReturnsPublisher
that emits all items as read from this connection.- Specified by:
read
in interfaceNettyConnection<Read,
Write> - Returns:
Publisher
that emits all items as read from this connection. Concurrent subscribes when aPublisherSource.Subscriber
is already active) are disallowed but sequential subscribes when a previousPublisherSource.Subscriber
has terminated) are allowed.
-
write
Description copied from interface:NettyConnection
Writes all elements emitted by the passedPublisher
on this connection.- Specified by:
write
in interfaceNettyConnection<Read,
Write> - Parameters:
write
-Publisher
, all objects emitted from which are written on this connection.- Returns:
Completable
that terminates as follows:
-
write
public Completable write(Publisher<Write> write, Supplier<FlushStrategy> flushStrategySupplier, Supplier<WriteDemandEstimator> demandEstimatorSupplier) Description copied from interface:NettyConnection
Writes all elements emitted by the passedPublisher
on this connection.- Specified by:
write
in interfaceNettyConnection<Read,
Write> - Parameters:
write
-Publisher
, all objects emitted from which are written on this connection.flushStrategySupplier
-Supplier
ofFlushStrategy
which controls the flush operations for this write.demandEstimatorSupplier
- ASupplier
ofWriteDemandEstimator
for this write.- Returns:
Completable
that terminates as follows:
-
doCloseAsyncGracefully
protected void doCloseAsyncGracefully()Description copied from class:NettyChannelListenableAsyncCloseable
Initiate graceful closure.- Overrides:
doCloseAsyncGracefully
in classNettyChannelListenableAsyncCloseable
-
localAddress
Description copied from interface:ConnectionInfo
TheSocketAddress
to which the associated connection is bound.- Specified by:
localAddress
in interfaceConnectionInfo
- Returns:
- The
SocketAddress
to which the associated connection is bound.
-
remoteAddress
Description copied from interface:ConnectionInfo
TheSocketAddress
to which the associated connection is connected.- Specified by:
remoteAddress
in interfaceConnectionInfo
- Returns:
- The
SocketAddress
to which the associated connection is connected.
-
sslConfig
Description copied from interface:ConnectionInfo
Get theSslConfig
for this connection.- Specified by:
sslConfig
in interfaceConnectionInfo
- Returns:
- The
SslConfig
if SSL/TLS is configured, ornull
otherwise.
-
sslSession
Description copied from interface:ConnectionInfo
Get theSSLSession
for this connection.- Specified by:
sslSession
in interfaceConnectionInfo
- Returns:
- The
SSLSession
if SSL/TLS is enabled, ornull
otherwise.
-
executionContext
Description copied from interface:ConnectionInfo
Get theExecutionContext
for thisConnectionInfo
.The
ExecutionContext.ioExecutor()
will represent the thread responsible for IO for thisConnectionInfo
. Note that this maybe different that what was used to create this object because at this time a specificIoExecutor
has been selected.- Specified by:
executionContext
in interfaceConnectionInfo
- Returns:
- the
ExecutionContext
for thisConnectionInfo
.
-
socketOption
Description copied from interface:ConnectionInfo
- Specified by:
socketOption
in interfaceConnectionInfo
- Type Parameters:
T
- the type of theSocketOption
value.- Parameters:
option
-SocketOption
to get.- Returns:
- the
SocketOption
value of typeT
for thisConnectionInfo
ornull
if thisSocketOption
is not supported by thisConnectionInfo
. - See Also:
-
protocol
Description copied from interface:ConnectionInfo
Get theConnectionInfo.Protocol
for thisConnectionInfo
.- Specified by:
protocol
in interfaceConnectionInfo
- Returns:
- the
ConnectionInfo.Protocol
for thisConnectionInfo
.
-
parent
Description copied from interface:ConnectionContext
Returns a reference to a parentConnectionContext
if any.This method is useful when multiple virtual streams are multiplexed over a single connection to get access to the actual
ConnectionContext
that represents network.- Specified by:
parent
in interfaceConnectionContext
- Returns:
- a reference to a parent
ConnectionContext
if any. Otherwise, returnsnull
.
-
nettyChannel
public io.netty.channel.Channel nettyChannel()Description copied from interface:NettyConnectionContext
Return the NettyChannel
backing this connection.- Specified by:
nettyChannel
in interfaceNettyConnectionContext
- Returns:
- the Netty
Channel
backing this connection.
-
toString
-
channelWritable
public void channelWritable() -
continueWriting
public void continueWriting() -
channelOutboundClosed
public void channelOutboundClosed() -
terminateSource
public void terminateSource() -
channelClosed
-
listenerDiscard
-
updateFlushStrategy
public Cancellable updateFlushStrategy(NettyConnectionContext.FlushStrategyProvider strategyProvider) Description copied from interface:NettyConnectionContext
UpdatesFlushStrategy
associated with this connection. UpdatedFlushStrategy
will be used in any subsequent writes on this connection.- Specified by:
updateFlushStrategy
in interfaceNettyConnectionContext
- 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
Description copied from interface:NettyConnectionContext
Returns theFlushStrategy
used by default for thisNettyConnectionContext
.- Specified by:
defaultFlushStrategy
in interfaceNettyConnectionContext
- Returns:
- The
FlushStrategy
used by default for thisNettyConnectionContext
.
-
transportError
Description copied from interface:NettyConnectionContext
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.- Specified by:
transportError
in interfaceNettyConnectionContext
- Returns:
- a
Single
<Throwable
> that may terminate with an error, if an error is observed at the transport.
-
#initChannel(Channel, ExecutionContext, CloseHandler, FlushStrategy, long, SslConfig, ChannelInitializer, Protocol, ConnectionObserver, boolean, Predicate)
.