Package io.servicetalk.client.api
Interface ConnectionFactory<ResolvedAddress,C extends ListenableAsyncCloseable>
- Type Parameters:
ResolvedAddress
- The type of a resolved address that can be used for connecting.C
- The type of connections created by this factory.
- All Superinterfaces:
AsyncCloseable
,ListenableAsyncCloseable
- All Known Implementing Classes:
DelegatingConnectionFactory
public interface ConnectionFactory<ResolvedAddress,C extends ListenableAsyncCloseable>
extends ListenableAsyncCloseable
A factory for creating new connections.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionnewConnection
(ResolvedAddress address, ContextMap context, TransportObserver observer) Creates and asynchronously returns a connection.newConnection
(ResolvedAddress address, TransportObserver observer) Deprecated.Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefully
Methods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
-
Method Details
-
newConnection
@Deprecated default Single<C> newConnection(ResolvedAddress address, @Nullable TransportObserver observer) Deprecated.Creates and asynchronously returns a connection.- Parameters:
address
- to connect.observer
-TransportObserver
for the newly created connection.- Returns:
Single
that emits the created connection.
-
newConnection
default Single<C> newConnection(ResolvedAddress address, @Nullable ContextMap context, @Nullable TransportObserver observer) Creates and asynchronously returns a connection.- Parameters:
address
- 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.
-
newConnection(Object, ContextMap, TransportObserver)
.