Interface CoordinationService

  • All Superinterfaces:
    java.lang.AutoCloseable
    All Known Implementing Classes:
    CoordinationServiceImpl

    public interface CoordinationService
    extends java.lang.AutoCloseable
    Interface for the coordination service. Provides abstraction for distributed locks and leader election.
    • Method Detail

      • getLeaderElection

        <T> LeaderElection<T> getLeaderElection​(java.lang.Class<T> clazz,
                                                java.lang.String path,
                                                java.util.function.Consumer<LeaderElectionState> stateChangesListener)
        Create a new LeaderElection controller.
        Parameters:
        clazz - the class type to be used for serialization/deserialization
        path - the path to use for the leader election
        stateChangesListener - a listener that will be passed all the state changes
        Returns:
      • getLockManager

        <T> LockManager<T> getLockManager​(java.lang.Class<T> clazz)
      • getNextCounterValue

        java.util.concurrent.CompletableFuture<java.lang.Long> getNextCounterValue​(java.lang.String path)
        Increment a counter identified by the specified path and return the current value. The counter value will be guaranteed to be unique within the context of the path. It will retry when MetadataStoreException happened. If the maximum number of retries is reached and still failed, the feature will complete with exception MetadataStoreException.
        Parameters:
        path - the path that identifies a particular counter
        Returns:
        a future that will track the completion of the operation
        Throws:
        CoordinationServiceException - if there's a failure in incrementing the counter