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 ConnectionStateListenerDecorator

    Allows for the enhancement of the ConnectionStateListener instances 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);