Package io.servicetalk.client.api
Interface ConnectionFactoryFilter<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 theConnectionFactory
decorated by this filter.
- All Known Implementing Classes:
LimitingConnectionFactoryFilter
,TransportObserverConnectionFactoryFilter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ConnectionFactoryFilter<ResolvedAddress,C extends ListenableAsyncCloseable>
A contract to decorateConnectionFactory
instances for the purpose of filtering.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ConnectionFactoryFilter<ResolvedAddress,C>
append(ConnectionFactoryFilter<ResolvedAddress,C> before)
Returns a composed function that first applies thebefore
function to its input, and then applies this function to the result.ConnectionFactory<ResolvedAddress,C>
create(ConnectionFactory<ResolvedAddress,C> original)
Decorates the passedoriginal
ConnectionFactory
to add the filtering logic.static <ResolvedAddress,C extends ListenableAsyncCloseable>
ConnectionFactoryFilter<ResolvedAddress,C>identity()
Returns a function that always returns its inputConnectionFactory
.
-
-
-
Method Detail
-
create
ConnectionFactory<ResolvedAddress,C> create(ConnectionFactory<ResolvedAddress,C> original)
Decorates the passedoriginal
ConnectionFactory
to add the filtering logic.- Parameters:
original
-ConnectionFactory
to filter.- Returns:
- Decorated
ConnectionFactory
that contains the filtering logic.
-
append
default ConnectionFactoryFilter<ResolvedAddress,C> append(ConnectionFactoryFilter<ResolvedAddress,C> before)
Returns a composed function that first applies thebefore
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:
builder.append(filter1).append(filter2).append(filter3)
CallingConnectionFactory
wrapped by this filter chain, the order of invocation of these filters will be:filter1 => filter2 => filter3 => original connection factory
- Parameters:
before
- the function to apply before this function is applied- Returns:
- a composed function that first applies the
before
function and then applies this function.
-
identity
static <ResolvedAddress,C extends ListenableAsyncCloseable> ConnectionFactoryFilter<ResolvedAddress,C> identity()
Returns a function that always returns its inputConnectionFactory
.- Type Parameters:
ResolvedAddress
- The type of a resolved address that can be used for connecting.C
- The type of connections created by theConnectionFactory
decorated by this filter.- Returns:
- a function that always returns its input
ConnectionFactory
.
-
-