Interface CoordinationService
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
CoordinationServiceImpl
public interface CoordinationService extends java.lang.AutoCloseableInterface for the coordination service. Provides abstraction for distributed locks and leader election.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> LeaderElection<T>getLeaderElection(java.lang.Class<T> clazz, java.lang.String path, java.util.function.Consumer<LeaderElectionState> stateChangesListener)Create a newLeaderElectioncontroller.<T> LockManager<T>getLockManager(java.lang.Class<T> clazz)<T> LockManager<T>getLockManager(MetadataSerde<T> serde)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.
-
-
-
Method Detail
-
getLeaderElection
<T> LeaderElection<T> getLeaderElection(java.lang.Class<T> clazz, java.lang.String path, java.util.function.Consumer<LeaderElectionState> stateChangesListener)
Create a newLeaderElectioncontroller.- Parameters:
clazz- the class type to be used for serialization/deserializationpath- the path to use for the leader electionstateChangesListener- a listener that will be passed all the state changes- Returns:
-
getLockManager
<T> LockManager<T> getLockManager(java.lang.Class<T> clazz)
-
getLockManager
<T> LockManager<T> getLockManager(MetadataSerde<T> serde)
-
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 whenMetadataStoreExceptionhappened. If the maximum number of retries is reached and still failed, the feature will complete with exceptionMetadataStoreException.- 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
-
-