Package io.servicetalk.client.api
Class DelegatingConnectionFactory<ResolvedAddress,C extends ListenableAsyncCloseable>
java.lang.Object
io.servicetalk.concurrent.api.DelegatingAsyncCloseable<T>
io.servicetalk.concurrent.api.DelegatingListenableAsyncCloseable<ConnectionFactory<ResolvedAddress,C>>
io.servicetalk.client.api.DelegatingConnectionFactory<ResolvedAddress,C>
- Type Parameters:
ResolvedAddress- The type of resolved addresses that can be used for connecting.C- The type of connections created by this factory.
- All Implemented Interfaces:
ConnectionFactory<ResolvedAddress,,C> AsyncCloseable,ListenableAsyncCloseable
public class DelegatingConnectionFactory<ResolvedAddress,C extends ListenableAsyncCloseable>
extends DelegatingListenableAsyncCloseable<ConnectionFactory<ResolvedAddress,C>>
implements ConnectionFactory<ResolvedAddress,C>
A
ConnectionFactory that delegates all methods to another ConnectionFactory.-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected final ConnectionFactory<ResolvedAddress,C> delegate()Get theConnectionFactorythat this class delegates to.newConnection(ResolvedAddress resolvedAddress, ContextMap context, TransportObserver observer) Creates and asynchronously returns a connection.newConnection(ResolvedAddress resolvedAddress, TransportObserver observer) Deprecated.Methods inherited from class io.servicetalk.concurrent.api.DelegatingListenableAsyncCloseable
onClose, onClosingMethods inherited from class io.servicetalk.concurrent.api.DelegatingAsyncCloseable
closeAsync, closeAsyncGracefully, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefullyMethods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
-
Constructor Details
-
DelegatingConnectionFactory
Create a new instance.- Parameters:
delegate-ConnectionFactoryto which all methods are delegated.
-
-
Method Details
-
delegate
Get theConnectionFactorythat this class delegates to.- Overrides:
delegatein classDelegatingListenableAsyncCloseable<ConnectionFactory<ResolvedAddress,C extends ListenableAsyncCloseable>> - Returns:
- the
ConnectionFactorythat this class delegates to.
-
newConnection
@Deprecated public Single<C> newConnection(ResolvedAddress resolvedAddress, @Nullable TransportObserver observer) Deprecated.Description copied from interface:ConnectionFactoryCreates and asynchronously returns a connection.- Specified by:
newConnectionin interfaceConnectionFactory<ResolvedAddress,C extends ListenableAsyncCloseable> - Parameters:
resolvedAddress- to connect.observer-TransportObserverfor the newly created connection.- Returns:
Singlethat emits the created connection.
-
newConnection
public Single<C> newConnection(ResolvedAddress resolvedAddress, @Nullable ContextMap context, @Nullable TransportObserver observer) Description copied from interface:ConnectionFactoryCreates and asynchronously returns a connection.- Specified by:
newConnectionin interfaceConnectionFactory<ResolvedAddress,C extends ListenableAsyncCloseable> - Parameters:
resolvedAddress- to connect.context-contextof the caller (e.g. request context) ornullif no context provided.nullcontext may also mean that a connection is created outside the normal request processing (e.g. health-checking).observer-TransportObserverfor the newly created connection ornullif no observer provided.- Returns:
Singlethat emits the created connection.
-