Class StandaloneLeaderRetrievalService
- java.lang.Object
-
- org.apache.flink.runtime.leaderretrieval.StandaloneLeaderRetrievalService
-
- All Implemented Interfaces:
LeaderRetrievalService
public class StandaloneLeaderRetrievalService extends Object implements LeaderRetrievalService
Standalone implementation of theLeaderRetrievalService
. 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
Constructors Constructor Description StandaloneLeaderRetrievalService(String leaderAddress)
Deprecated.UseStandaloneLeaderRetrievalService(String, UUID)
insteadStandaloneLeaderRetrievalService(String leaderAddress, UUID leaderId)
Creates a StandaloneLeaderRetrievalService with the given leader address.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
start(LeaderRetrievalListener listener)
Starts the leader retrieval service with the given listener to listen for new leaders.void
stop()
Stops the leader retrieval service.
-
-
-
Constructor Detail
-
StandaloneLeaderRetrievalService
@Deprecated public StandaloneLeaderRetrievalService(String leaderAddress)
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
-
-
Method Detail
-
start
public void start(LeaderRetrievalListener listener)
Description copied from interface:LeaderRetrievalService
Starts the leader retrieval service with the given listener to listen for new leaders. This method can only be called once.- Specified by:
start
in interfaceLeaderRetrievalService
- Parameters:
listener
- The leader retrieval listener which will be notified about new leaders.
-
stop
public void stop()
Description copied from interface:LeaderRetrievalService
Stops the leader retrieval service.- Specified by:
stop
in interfaceLeaderRetrievalService
-
-