Interface JobManager<T extends Job>


@Contract public interface JobManager<T extends Job>
This is the contract for the JobManagerService The JobManager will be responsible for 1. generating unique ids for jobs 2. serving as a registry for jobs 3. creating thread pools for jobs 4.removing expired jobs
Author:
Martin Mares, Bhakti Mehta
  • Method Details

    • getNewId

      String getNewId()
      This method is used to generate a unique id for a managed job
      Returns:
      returns a new id for the job
    • registerJob

      void registerJob(T instance) throws IllegalArgumentException
      This method will register the job in the job registry
      Parameters:
      instance - job to be registered
      Throws:
      IllegalArgumentException
    • getJobs

      Iterator<T> getJobs()
      This method will return the list of jobs in the job registry
      Returns:
      list of jobs
    • get

      T get(String id)
      This method is used to get a job by its id
      Parameters:
      id - The id to look up the job in the job registry
      Returns:
      the Job or null
    • purgeJob

      void purgeJob(String id)
      This will purge the job associated with the id from the registry
      Parameters:
      id - the id of the Job which needs to be purged
    • getCompletedJobs

      JobInfos getCompletedJobs(File jobs)
      This will get the list of jobs from the job registry which have completed
      Returns:
      the details of all completed jobs using JobInfos. Never null.
    • getCompletedJobForId

      JobInfo getCompletedJobForId(String id, File jobsFile)
      This is a convenience method to get a completed job with an id
      Parameters:
      id - the completed Job whose id needs to be looked up
      Returns:
      the completed Job
    • purgeCompletedJobForId

      JobInfos purgeCompletedJobForId(JobInfo job)
      This is used to purge a completed job.
      Parameters:
      job - the info about Job
      Returns:
      the new list of completed jobs
    • checkpoint

      void checkpoint(AdminCommand command, AdminCommandContext context) throws IOException
      Stores current command state.
      Throws:
      IOException
    • checkpoint

      void checkpoint(AdminCommandContext context, Serializable data) throws IOException
      Stores current command state.
      Throws:
      IOException
    • loadCheckpointData

      T loadCheckpointData(String jobId) throws IOException, ClassNotFoundException
      Load checkpoint related data.
      Throws:
      IOException
      ClassNotFoundException
    • createJob

      T createJob(String scope, String name, Subject subject, boolean isManagedJob, ParameterMap parameters, ActionReport report)
      This will create a new job with the name of command and a new unused id for the job
      Parameters:
      scope - The scope of the command or null if there is no scope
      name - The name of the command
      Returns:
      a newly created job
    • start

      Starts the command asynchronously
      Parameters:
      command -