public class DelegatingConnectionContext extends java.lang.Object implements ConnectionContext
ConnectionContext implementation that delegates all calls to a provided ConnectionContext. Any of
the methods can be overridden by implementations to change the behavior.ConnectionContext.Protocol| Constructor and Description |
|---|
DelegatingConnectionContext(ConnectionContext delegate)
New instance.
|
| Modifier and Type | Method and Description |
|---|---|
Completable |
closeAsync()
Used to close/shutdown a resource.
|
Completable |
closeAsyncGracefully()
Used to close/shutdown a resource, similar to
AsyncCloseable.closeAsync(), but attempts to cleanup state before
abruptly closing. |
protected ConnectionContext |
delegate()
Get the
ConnectionContext that this class delegates to. |
ExecutionContext |
executionContext()
Get the
ExecutionContext for this ConnectionContext. |
java.net.SocketAddress |
localAddress()
The
SocketAddress to which the associated connection is bound. |
Completable |
onClose()
Returns a
Completable that is notified once the ListenableAsyncCloseable was closed. |
ConnectionContext.Protocol |
protocol()
Get the
ConnectionContext.Protocol for this ConnectionContext. |
java.net.SocketAddress |
remoteAddress()
The
SocketAddress to which the associated connection is connected. |
<T> T |
socketOption(java.net.SocketOption<T> option)
|
javax.net.ssl.SSLSession |
sslSession()
Get the
SSLSession for this connection. |
public DelegatingConnectionContext(ConnectionContext delegate)
delegate - ConnectionContext to delegate all calls.protected ConnectionContext delegate()
ConnectionContext that this class delegates to.ConnectionContext that this class delegates to.public java.net.SocketAddress localAddress()
ConnectionContextSocketAddress to which the associated connection is bound.localAddress in interface ConnectionContextSocketAddress to which the associated connection is bound.public java.net.SocketAddress remoteAddress()
ConnectionContextSocketAddress to which the associated connection is connected.remoteAddress in interface ConnectionContextSocketAddress to which the associated connection is connected.@Nullable public javax.net.ssl.SSLSession sslSession()
ConnectionContextSSLSession for this connection.sslSession in interface ConnectionContextSSLSession if SSL/TLS is enabled, or null otherwise.public ExecutionContext executionContext()
ConnectionContextExecutionContext for this ConnectionContext.
The ExecutionContext.ioExecutor() will represent the thread responsible for IO for this
ConnectionContext. Note that this maybe different that what was used to create this object because
at this time a specific IoExecutor has been selected.
executionContext in interface ConnectionContextExecutionContext for this ConnectionContext.public <T> T socketOption(java.net.SocketOption<T> option)
ConnectionContextsocketOption in interface ConnectionContextT - the type of the SocketOption value.option - SocketOption to get.SocketOption value of type T for this ConnectionContext or null if
this SocketOption is not supported by this ConnectionContext.StandardSocketOptions,
ServiceTalkSocketOptionspublic ConnectionContext.Protocol protocol()
ConnectionContextConnectionContext.Protocol for this ConnectionContext.protocol in interface ConnectionContextConnectionContext.Protocol for this ConnectionContext.public Completable onClose()
ListenableAsyncCloseableCompletable that is notified once the ListenableAsyncCloseable was closed.onClose in interface ListenableAsyncCloseableCompletable that is notified on close.public Completable closeAsync()
AsyncCloseablecloseAsync in interface AsyncCloseableCompletableSource that is notified once the close is complete.public Completable closeAsyncGracefully()
AsyncCloseableAsyncCloseable.closeAsync(), but attempts to cleanup state before
abruptly closing. This provides a hint that implementations can use to stop accepting new work and finish in
flight work. This method is implemented on a "best effort" basis and may be equivalent to AsyncCloseable.closeAsync().
Note: Implementations may or may not apply a timeout for this operation to complete, if a caller does not
want to wait indefinitely, and are unsure if the implementation applies a timeout, it is advisable to apply a
timeout and force a call to AsyncCloseable.closeAsync().
closeAsyncGracefully in interface AsyncCloseableCompletable that is notified once the close is complete.