ResolvedAddress
- The type of a resolved address that can be used for connecting.C
- The type of connections created by the ConnectionFactory
decorated by this filter.public final class TransportObserverConnectionFactoryFilter<ResolvedAddress,C extends ListenableAsyncCloseable> extends java.lang.Object implements ConnectionFactoryFilter<ResolvedAddress,C>
ConnectionFactoryFilter
that configures a TransportObserver
for new connections.Constructor and Description |
---|
TransportObserverConnectionFactoryFilter(java.util.function.Function<ResolvedAddress,TransportObserver> observerFactory)
Creates a new instance.
|
TransportObserverConnectionFactoryFilter(TransportObserver observer)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
ConnectionFactory<ResolvedAddress,C> |
create(ConnectionFactory<ResolvedAddress,C> original)
Decorates the passed
original ConnectionFactory to add the filtering logic. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
append, identity
public TransportObserverConnectionFactoryFilter(TransportObserver observer)
observer
- TransportObserver
to use for new connectionspublic TransportObserverConnectionFactoryFilter(java.util.function.Function<ResolvedAddress,TransportObserver> observerFactory)
observerFactory
- a factory to create a TransportObserver
for new connections per
ResolvedAddress
. May return null
to avoid configuring TransportObserver
for some
addresses.public ConnectionFactory<ResolvedAddress,C> create(ConnectionFactory<ResolvedAddress,C> original)
ConnectionFactoryFilter
original
ConnectionFactory
to add the filtering logic.create
in interface ConnectionFactoryFilter<ResolvedAddress,C extends ListenableAsyncCloseable>
original
- ConnectionFactory
to filter.ConnectionFactory
that contains the filtering logic.