ResolvedAddress - The type of resolved addresses that can be used for connecting.C - The type of connections created by the ConnectionFactory decorated by this filter.@FunctionalInterface
public interface ConnectionFactoryFilter<ResolvedAddress,C extends ListenableAsyncCloseable>
extends ExecutionStrategyInfluencer<ExecutionStrategy>
ConnectionFactory instances for the purpose of filtering.| Modifier and Type | Method and Description |
|---|---|
default ConnectionFactoryFilter<ResolvedAddress,C> |
append(ConnectionFactoryFilter<ResolvedAddress,C> before)
Returns a composed function that first applies the
before function to its input, and then applies
this function to the result. |
ConnectionFactory<ResolvedAddress,C> |
create(ConnectionFactory<ResolvedAddress,C> original)
Decorates the passed
original ConnectionFactory to add the filtering logic. |
static <RA,C extends ListenableAsyncCloseable> |
identity()
Returns a function that always returns its input
ConnectionFactory. |
default ExecutionStrategy |
requiredOffloads() |
static <RA,C extends ListenableAsyncCloseable> |
withStrategy(ConnectionFactoryFilter<RA,C> original,
ExecutionStrategy strategy)
Wraps a connection factory filter to return a specific execution strategy.
|
ConnectionFactory<ResolvedAddress,C> create(ConnectionFactory<ResolvedAddress,C> original)
original ConnectionFactory to add the filtering logic.original - ConnectionFactory to filter.ConnectionFactory that contains the filtering logic.static <RA,C extends ListenableAsyncCloseable> ConnectionFactoryFilter<RA,C> identity()
ConnectionFactory.RA - The type of resolved address that can be used for connecting.C - The type of connections created by the ConnectionFactory decorated by this filter.ConnectionFactory.default ConnectionFactoryFilter<ResolvedAddress,C> append(ConnectionFactoryFilter<ResolvedAddress,C> before)
before function to its input, and then applies
this function to the result.
The order of execution of these filters are in order of append. If 3 filters are added as follows:
factory.append(filter1).append(filter2).append(filter3)
accepting a connection by a filter wrapped by this filter chain, the order of invocation of these filters will
be:
filter1 ⇒ filter2 ⇒ filter3
before - the function to apply before this function is appliedbefore
function and then applies this functiondefault ExecutionStrategy requiredOffloads()
If the returned strategy extends ConnectExecutionStrategy then the connection creation or accept may
be offloaded.
If the returned strategy extends HttpExecutionStrategy then the HTTP execution strategy will be
applied to the connections created.
A utility class provides the ability to combine connect and HTTP execution strategies,
io.servicetalk.http.api.ConnectAndHttpExecutionStrategy.
requiredOffloads in interface ExecutionStrategyInfluencer<ExecutionStrategy>static <RA,C extends ListenableAsyncCloseable> ConnectionFactoryFilter<RA,C> withStrategy(ConnectionFactoryFilter<RA,C> original, ExecutionStrategy strategy)
RA - The type of resolved addresses that can be used for connecting.C - The type of connections created by the ConnectionFactory decorated by this filter.original - connection factory filter to be wrapped.strategy - execution strategy for the wrapped filterConnectionFactoryFilter