Class DefaultJobLeaderIdService
java.lang.Object
org.apache.flink.runtime.resourcemanager.DefaultJobLeaderIdService
- All Implemented Interfaces:
JobLeaderIdService
Service which retrieves for a registered job the current job leader id (the leader id of the job
manager responsible for the job). The leader id will be exposed as a future via the
getLeaderId(JobID). The future will only be completed with an exception in case the service
will be stopped.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultJobLeaderIdService(HighAvailabilityServices highAvailabilityServices, org.apache.flink.util.concurrent.ScheduledExecutor scheduledExecutor, Duration jobTimeout) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddJob(org.apache.flink.api.common.JobID jobId) Add a job to be monitored to retrieve the job leader id.voidclear()Stop and clear the currently registered job leader id listeners.booleancontainsJob(org.apache.flink.api.common.JobID jobId) Check whether the given job is being monitored or not.getLeaderId(org.apache.flink.api.common.JobID jobId) Get the leader'sJobMasterIdfuture for the given job.booleanChecks whether the service has been started.booleanisValidTimeout(org.apache.flink.api.common.JobID jobId, UUID timeoutId) Checks whether the given timeoutId for the given jobId is valid or not.voidremoveJob(org.apache.flink.api.common.JobID jobId) Remove the given job from being monitored by the service.voidstart(JobLeaderIdActions initialJobLeaderIdActions) Start the service with the given job leader actions.voidstop()Stop the service.
-
Constructor Details
-
DefaultJobLeaderIdService
public DefaultJobLeaderIdService(HighAvailabilityServices highAvailabilityServices, org.apache.flink.util.concurrent.ScheduledExecutor scheduledExecutor, Duration jobTimeout)
-
-
Method Details
-
start
Description copied from interface:JobLeaderIdServiceStart the service with the given job leader actions.- Specified by:
startin interfaceJobLeaderIdService- Parameters:
initialJobLeaderIdActions- to use for job leader id actions- Throws:
Exception- which is thrown when clearing up old state
-
stop
Description copied from interface:JobLeaderIdServiceStop the service.- Specified by:
stopin interfaceJobLeaderIdService- Throws:
Exception- which is thrown in case a retrieval service cannot be stopped properly
-
isStarted
public boolean isStarted()Checks whether the service has been started.- Returns:
- True if the service has been started; otherwise false
-
clear
Description copied from interface:JobLeaderIdServiceStop and clear the currently registered job leader id listeners.- Specified by:
clearin interfaceJobLeaderIdService- Throws:
Exception- which is thrown in case a retrieval service cannot be stopped properly
-
addJob
Description copied from interface:JobLeaderIdServiceAdd a job to be monitored to retrieve the job leader id.- Specified by:
addJobin interfaceJobLeaderIdService- Parameters:
jobId- identifying the job to monitor- Throws:
Exception- if the job could not be added to the service
-
removeJob
Description copied from interface:JobLeaderIdServiceRemove the given job from being monitored by the service.- Specified by:
removeJobin interfaceJobLeaderIdService- Parameters:
jobId- identifying the job to remove from monitor- Throws:
Exception- if removing the job fails
-
containsJob
public boolean containsJob(org.apache.flink.api.common.JobID jobId) Description copied from interface:JobLeaderIdServiceCheck whether the given job is being monitored or not.- Specified by:
containsJobin interfaceJobLeaderIdService- Parameters:
jobId- identifying the job- Returns:
- True if the job is being monitored; otherwise false
-
getLeaderId
public CompletableFuture<JobMasterId> getLeaderId(org.apache.flink.api.common.JobID jobId) throws Exception Description copied from interface:JobLeaderIdServiceGet the leader'sJobMasterIdfuture for the given job.- Specified by:
getLeaderIdin interfaceJobLeaderIdService- Parameters:
jobId- jobId specifying for which job to retrieve theJobMasterId- Returns:
- Future with the current leader's
JobMasterId - Throws:
Exception- if retrieving theJobMasterIdcannot be started
-
isValidTimeout
Description copied from interface:JobLeaderIdServiceChecks whether the given timeoutId for the given jobId is valid or not.- Specified by:
isValidTimeoutin interfaceJobLeaderIdService- Parameters:
jobId- jobId identifying the job for which the timeout should be checkedtimeoutId- timeoutId specifying the timeout which should be checked for its validity- Returns:
trueif the timeout is valid; otherwisefalse
-