Class StandaloneLeaderRetrievalService
java.lang.Object
org.apache.flink.runtime.leaderretrieval.StandaloneLeaderRetrievalService
- All Implemented Interfaces:
LeaderRetrievalService
Standalone implementation of the
LeaderRetrievalService. This implementation assumes that
there is only a single contender for leadership (e.g., a single JobManager or ResourceManager
process) and that this process is reachable under a constant address.
As soon as this service is started, it immediately notifies the leader listener of the leader contender with the pre-configured address.
-
Constructor Summary
ConstructorsConstructorDescriptionStandaloneLeaderRetrievalService(String leaderAddress) Deprecated.StandaloneLeaderRetrievalService(String leaderAddress, UUID leaderId) Creates a StandaloneLeaderRetrievalService with the given leader address. -
Method Summary
Modifier and TypeMethodDescriptionvoidstart(LeaderRetrievalListener listener) Starts the leader retrieval service with the given listener to listen for new leaders.voidstop()Stops the leader retrieval service.
-
Constructor Details
-
StandaloneLeaderRetrievalService
Deprecated.UseStandaloneLeaderRetrievalService(String, UUID)insteadCreates a StandaloneLeaderRetrievalService with the given leader address. The leaderId will be null.- Parameters:
leaderAddress- The leader's pre-configured address
-
StandaloneLeaderRetrievalService
Creates a StandaloneLeaderRetrievalService with the given leader address.- Parameters:
leaderAddress- The leader's pre-configured addressleaderId- The constant leaderId.
-
-
Method Details
-
start
Description copied from interface:LeaderRetrievalServiceStarts the leader retrieval service with the given listener to listen for new leaders. This method can only be called once.- Specified by:
startin interfaceLeaderRetrievalService- Parameters:
listener- The leader retrieval listener which will be notified about new leaders.
-
stop
public void stop()Description copied from interface:LeaderRetrievalServiceStops the leader retrieval service.- Specified by:
stopin interfaceLeaderRetrievalService
-
StandaloneLeaderRetrievalService(String, UUID)instead