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 theConnectionFactory
that 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, onClosing
Methods inherited from class io.servicetalk.concurrent.api.DelegatingAsyncCloseable
closeAsync, closeAsyncGracefully, toString
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, onClosing
-
Constructor Details
-
DelegatingConnectionFactory
Create a new instance.- Parameters:
delegate
-ConnectionFactory
to which all methods are delegated.
-
-
Method Details
-
delegate
Get theConnectionFactory
that this class delegates to.- Overrides:
delegate
in classDelegatingListenableAsyncCloseable<ConnectionFactory<ResolvedAddress,
C extends ListenableAsyncCloseable>> - Returns:
- the
ConnectionFactory
that this class delegates to.
-
newConnection
@Deprecated public Single<C> newConnection(ResolvedAddress resolvedAddress, @Nullable TransportObserver observer) Deprecated.Description copied from interface:ConnectionFactory
Creates and asynchronously returns a connection.- Specified by:
newConnection
in interfaceConnectionFactory<ResolvedAddress,
C extends ListenableAsyncCloseable> - Parameters:
resolvedAddress
- to connect.observer
-TransportObserver
for the newly created connection.- Returns:
Single
that emits the created connection.
-
newConnection
public Single<C> newConnection(ResolvedAddress resolvedAddress, @Nullable ContextMap context, @Nullable TransportObserver observer) Description copied from interface:ConnectionFactory
Creates and asynchronously returns a connection.- Specified by:
newConnection
in interfaceConnectionFactory<ResolvedAddress,
C extends ListenableAsyncCloseable> - Parameters:
resolvedAddress
- to connect.context
-context
of the caller (e.g. request context) ornull
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 ornull
if no observer provided.- Returns:
Single
that emits the created connection.
-