Interface ConnectionStateListenerDecorator
-
- 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 ConnectionStateListenerDecoratorAllows for the enhancement of the
ConnectionStateListenerinstances used with Curator. Client code that sets a ConnectionStateListener should always wrap it using the configured ConnectionStateListenerDecorator. All Curator recipes do this.E.g.
CuratorFramework client ... ConnectionStateListener listener = ... ConnectionStateListener decoratedListener = client.decorateConnectionStateListener(listener); ... client.getConnectionStateListenable().addListener(decoratedListener); // later, to remove... client.getConnectionStateListenable().removeListener(decoratedListener);
-
-
Field Summary
Fields Modifier and Type Field Description static ConnectionStateListenerDecoratorstandardPass through - does no decoration
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static ConnectionStateListenerDecoratorcircuitBreaking(org.apache.curator.RetryPolicy retryPolicy)Decorates the listener with circuit breaking behavior usingCircuitBreakingConnectionStateListenerstatic ConnectionStateListenerDecoratorcircuitBreaking(org.apache.curator.RetryPolicy retryPolicy, java.util.concurrent.ScheduledExecutorService service)Decorates the listener with circuit breaking behavior usingCircuitBreakingConnectionStateListenerConnectionStateListenerdecorateListener(CuratorFramework client, ConnectionStateListener actual)
-
-
-
Field Detail
-
standard
static final ConnectionStateListenerDecorator standard
Pass through - does no decoration
-
-
Method Detail
-
decorateListener
ConnectionStateListener decorateListener(CuratorFramework client, ConnectionStateListener actual)
-
circuitBreaking
static ConnectionStateListenerDecorator circuitBreaking(org.apache.curator.RetryPolicy retryPolicy)
Decorates the listener with circuit breaking behavior usingCircuitBreakingConnectionStateListener- Parameters:
retryPolicy- the circuit breaking policy to use- Returns:
- new decorator
-
circuitBreaking
static ConnectionStateListenerDecorator circuitBreaking(org.apache.curator.RetryPolicy retryPolicy, java.util.concurrent.ScheduledExecutorService service)
Decorates the listener with circuit breaking behavior usingCircuitBreakingConnectionStateListener- Parameters:
retryPolicy- the circuit breaking policy to useservice- the scheduler to use- Returns:
- new decorator
-
-