Class DefaultJobLeaderIdService

java.lang.Object
org.apache.flink.runtime.resourcemanager.DefaultJobLeaderIdService
All Implemented Interfaces:
JobLeaderIdService

public class DefaultJobLeaderIdService extends Object implements 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

    Constructors
    Constructor
    Description
    DefaultJobLeaderIdService(HighAvailabilityServices highAvailabilityServices, org.apache.flink.util.concurrent.ScheduledExecutor scheduledExecutor, Duration jobTimeout)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addJob(org.apache.flink.api.common.JobID jobId)
    Add a job to be monitored to retrieve the job leader id.
    void
    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.
    getLeaderId(org.apache.flink.api.common.JobID jobId)
    Get the leader's JobMasterId future for the given job.
    boolean
    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 the service.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultJobLeaderIdService

      public DefaultJobLeaderIdService(HighAvailabilityServices highAvailabilityServices, org.apache.flink.util.concurrent.ScheduledExecutor scheduledExecutor, Duration jobTimeout)
  • Method Details

    • start

      public void start(JobLeaderIdActions initialJobLeaderIdActions) throws Exception
      Description copied from interface: JobLeaderIdService
      Start the service with the given job leader actions.
      Specified by:
      start in interface JobLeaderIdService
      Parameters:
      initialJobLeaderIdActions - to use for job leader id actions
      Throws:
      Exception - which is thrown when clearing up old state
    • stop

      public void stop() throws Exception
      Description copied from interface: JobLeaderIdService
      Stop the service.
      Specified by:
      stop in interface JobLeaderIdService
      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

      public void clear() throws Exception
      Description copied from interface: JobLeaderIdService
      Stop and clear the currently registered job leader id listeners.
      Specified by:
      clear in interface JobLeaderIdService
      Throws:
      Exception - which is thrown in case a retrieval service cannot be stopped properly
    • addJob

      public void addJob(org.apache.flink.api.common.JobID jobId) throws Exception
      Description copied from interface: JobLeaderIdService
      Add a job to be monitored to retrieve the job leader id.
      Specified by:
      addJob in interface JobLeaderIdService
      Parameters:
      jobId - identifying the job to monitor
      Throws:
      Exception - if the job could not be added to the service
    • removeJob

      public void removeJob(org.apache.flink.api.common.JobID jobId) throws Exception
      Description copied from interface: JobLeaderIdService
      Remove the given job from being monitored by the service.
      Specified by:
      removeJob in interface JobLeaderIdService
      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: JobLeaderIdService
      Check whether the given job is being monitored or not.
      Specified by:
      containsJob in interface JobLeaderIdService
      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: JobLeaderIdService
      Get the leader's JobMasterId future for the given job.
      Specified by:
      getLeaderId in interface JobLeaderIdService
      Parameters:
      jobId - jobId specifying for which job to retrieve the JobMasterId
      Returns:
      Future with the current leader's JobMasterId
      Throws:
      Exception - if retrieving the JobMasterId cannot be started
    • isValidTimeout

      public boolean isValidTimeout(org.apache.flink.api.common.JobID jobId, UUID timeoutId)
      Description copied from interface: JobLeaderIdService
      Checks whether the given timeoutId for the given jobId is valid or not.
      Specified by:
      isValidTimeout in interface JobLeaderIdService
      Parameters:
      jobId - jobId identifying the job for which the timeout should be checked
      timeoutId - timeoutId specifying the timeout which should be checked for its validity
      Returns:
      true if the timeout is valid; otherwise false