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,
ScheduledExecutor scheduledExecutor,
Time jobTimeout) |
Modifier and Type | Method and Description |
---|---|
void |
addJob(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(JobID jobId)
Check whether the given job is being monitored or not.
|
CompletableFuture<JobMasterId> |
getLeaderId(JobID jobId)
Get the leader's
JobMasterId future for the given job. |
boolean |
isStarted()
Checks whether the service has been started.
|
boolean |
isValidTimeout(JobID jobId,
UUID timeoutId)
Checks whether the given timeoutId for the given jobId is valid or not.
|
void |
removeJob(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, ScheduledExecutor scheduledExecutor, Time jobTimeout)
public void start(JobLeaderIdActions initialJobLeaderIdActions) throws Exception
JobLeaderIdService
start
in interface JobLeaderIdService
initialJobLeaderIdActions
- to use for job leader id actionsException
- which is thrown when clearing up old statepublic void stop() throws Exception
JobLeaderIdService
stop
in interface JobLeaderIdService
Exception
- which is thrown in case a retrieval service cannot be stopped properlypublic boolean isStarted()
public void clear() throws Exception
JobLeaderIdService
clear
in interface JobLeaderIdService
Exception
- which is thrown in case a retrieval service cannot be stopped properlypublic void addJob(JobID jobId) throws Exception
JobLeaderIdService
addJob
in interface JobLeaderIdService
jobId
- identifying the job to monitorException
- if the job could not be added to the servicepublic void removeJob(JobID jobId) throws Exception
JobLeaderIdService
removeJob
in interface JobLeaderIdService
jobId
- identifying the job to remove from monitorException
- if removing the job failspublic boolean containsJob(JobID jobId)
JobLeaderIdService
containsJob
in interface JobLeaderIdService
jobId
- identifying the jobpublic CompletableFuture<JobMasterId> getLeaderId(JobID jobId) throws Exception
JobLeaderIdService
JobMasterId
future for the given job.getLeaderId
in interface JobLeaderIdService
jobId
- jobId specifying for which job to retrieve the JobMasterId
JobMasterId
Exception
- if retrieving the JobMasterId
cannot be startedpublic boolean isValidTimeout(JobID jobId, UUID timeoutId)
JobLeaderIdService
isValidTimeout
in interface JobLeaderIdService
jobId
- 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 false
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.