Class CoordinationServiceImpl
- java.lang.Object
-
- org.apache.pulsar.metadata.coordination.impl.CoordinationServiceImpl
-
- All Implemented Interfaces:
java.lang.AutoCloseable,CoordinationService
public class CoordinationServiceImpl extends java.lang.Object implements CoordinationService
-
-
Constructor Summary
Constructors Constructor Description CoordinationServiceImpl(MetadataStoreExtended store)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()<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.
-
-
-
Constructor Detail
-
CoordinationServiceImpl
public CoordinationServiceImpl(MetadataStoreExtended store)
-
-
Method Detail
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
getLockManager
public <T> LockManager<T> getLockManager(java.lang.Class<T> clazz)
- Specified by:
getLockManagerin interfaceCoordinationService
-
getLockManager
public <T> LockManager<T> getLockManager(MetadataSerde<T> serde)
- Specified by:
getLockManagerin interfaceCoordinationService
-
getNextCounterValue
public java.util.concurrent.CompletableFuture<java.lang.Long> getNextCounterValue(java.lang.String path)
Description copied from interface:CoordinationServiceIncrement 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.- Specified by:
getNextCounterValuein interfaceCoordinationService- Parameters:
path- the path that identifies a particular counter- Returns:
- a future that will track the completion of the operation
-
getLeaderElection
public <T> LeaderElection<T> getLeaderElection(java.lang.Class<T> clazz, java.lang.String path, java.util.function.Consumer<LeaderElectionState> stateChangesListener)
Description copied from interface:CoordinationServiceCreate a newLeaderElectioncontroller.- Specified by:
getLeaderElectionin interfaceCoordinationService- 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:
-
-