public class DefaultJobLeaderIdService extends Object implements JobLeaderIdService
getLeaderId(JobID). The future will only be completed with an exception in case the service
will be stopped.| Constructor and Description |
|---|
DefaultJobLeaderIdService(HighAvailabilityServices highAvailabilityServices,
org.apache.flink.util.concurrent.ScheduledExecutor scheduledExecutor,
org.apache.flink.api.common.time.Time jobTimeout) |
| Modifier and Type | Method and Description |
|---|---|
void |
addJob(org.apache.flink.api.common.JobID jobId)
Add a job to be monitored to retrieve the job leader id.
|
void |
clear()
Stop and clear the currently registered job leader id listeners.
|
boolean |
containsJob(org.apache.flink.api.common.JobID jobId)
Check whether the given job is being monitored or not.
|
CompletableFuture<JobMasterId> |
getLeaderId(org.apache.flink.api.common.JobID jobId)
Get the leader's
JobMasterId future for the given job. |
boolean |
isStarted()
Checks whether the service has been started.
|
boolean |
isValidTimeout(org.apache.flink.api.common.JobID jobId,
UUID timeoutId)
Checks whether the given timeoutId for the given jobId is valid or not.
|
void |
removeJob(org.apache.flink.api.common.JobID jobId)
Remove the given job from being monitored by the service.
|
void |
start(JobLeaderIdActions initialJobLeaderIdActions)
Start the service with the given job leader actions.
|
void |
stop()
Stop the service.
|
public DefaultJobLeaderIdService(HighAvailabilityServices highAvailabilityServices, org.apache.flink.util.concurrent.ScheduledExecutor scheduledExecutor, org.apache.flink.api.common.time.Time jobTimeout)
public void start(JobLeaderIdActions initialJobLeaderIdActions) throws Exception
JobLeaderIdServicestart in interface JobLeaderIdServiceinitialJobLeaderIdActions - to use for job leader id actionsException - which is thrown when clearing up old statepublic void stop()
throws Exception
JobLeaderIdServicestop in interface JobLeaderIdServiceException - which is thrown in case a retrieval service cannot be stopped properlypublic boolean isStarted()
public void clear()
throws Exception
JobLeaderIdServiceclear in interface JobLeaderIdServiceException - which is thrown in case a retrieval service cannot be stopped properlypublic void addJob(org.apache.flink.api.common.JobID jobId)
throws Exception
JobLeaderIdServiceaddJob in interface JobLeaderIdServicejobId - identifying the job to monitorException - if the job could not be added to the servicepublic void removeJob(org.apache.flink.api.common.JobID jobId)
throws Exception
JobLeaderIdServiceremoveJob in interface JobLeaderIdServicejobId - identifying the job to remove from monitorException - if removing the job failspublic boolean containsJob(org.apache.flink.api.common.JobID jobId)
JobLeaderIdServicecontainsJob in interface JobLeaderIdServicejobId - identifying the jobpublic CompletableFuture<JobMasterId> getLeaderId(org.apache.flink.api.common.JobID jobId) throws Exception
JobLeaderIdServiceJobMasterId future for the given job.getLeaderId in interface JobLeaderIdServicejobId - jobId specifying for which job to retrieve the JobMasterIdJobMasterIdException - if retrieving the JobMasterId cannot be startedpublic boolean isValidTimeout(org.apache.flink.api.common.JobID jobId,
UUID timeoutId)
JobLeaderIdServiceisValidTimeout in interface JobLeaderIdServicejobId - jobId identifying the job for which the timeout should be checkedtimeoutId - timeoutId specifying the timeout which should be checked for its validitytrue if the timeout is valid; otherwise falseCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.