ResolvedAddress - The type of resolved addresses that can be used for connecting.C - The type of connections created by this factory.public class DelegatingConnectionFactory<ResolvedAddress,C extends ListenableAsyncCloseable> extends Object implements ConnectionFactory<ResolvedAddress,C>
ConnectionFactory that delegates all methods to another ConnectionFactory.| Constructor and Description |
|---|
DelegatingConnectionFactory(ConnectionFactory<ResolvedAddress,C> delegate)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
Completable |
closeAsync() |
Completable |
closeAsyncGracefully() |
protected ConnectionFactory<ResolvedAddress,C> |
delegate()
Returns the
ConnectionFactory delegate. |
Single<C> |
newConnection(ResolvedAddress resolvedAddress,
ContextMap context,
TransportObserver observer)
Creates and asynchronously returns a connection.
|
Single<C> |
newConnection(ResolvedAddress resolvedAddress,
TransportObserver observer)
Deprecated.
|
Completable |
onClose() |
Completable |
onClosing() |
public DelegatingConnectionFactory(ConnectionFactory<ResolvedAddress,C> delegate)
delegate - ConnectionFactory to which all methods are delegated.@Deprecated public Single<C> newConnection(ResolvedAddress resolvedAddress, @Nullable TransportObserver observer)
ConnectionFactorynewConnection in interface ConnectionFactory<ResolvedAddress,C extends ListenableAsyncCloseable>resolvedAddress - to connect.observer - TransportObserver for the newly created connection.Single that emits the created connection.public Single<C> newConnection(ResolvedAddress resolvedAddress, @Nullable ContextMap context, @Nullable TransportObserver observer)
ConnectionFactorynewConnection in interface ConnectionFactory<ResolvedAddress,C extends ListenableAsyncCloseable>resolvedAddress - to connect.context - context of the caller (e.g. request context) or null if no context
provided. null context may also mean that a connection is created outside the normal request processing
(e.g. health-checking).observer - TransportObserver for the newly created connection or null if no observer
provided.Single that emits the created connection.public Completable onClose()
onClose in interface ListenableAsyncCloseablepublic Completable onClosing()
onClosing in interface ListenableAsyncCloseablepublic Completable closeAsync()
closeAsync in interface AsyncCloseablepublic Completable closeAsyncGracefully()
closeAsyncGracefully in interface AsyncCloseableprotected final ConnectionFactory<ResolvedAddress,C> delegate()
ConnectionFactory delegate.ConnectionFactory.