Interface JobExplorer

All Known Implementing Classes:
SimpleJobExplorer

public interface JobExplorer
Entry point for browsing the executions of running or historical jobs and steps. Since the data may be re-hydrated from persistent storage, it cannot contain volatile fields that would have been present when the execution was active.
Since:
2.0
Author:
Dave Syer, Michael Minella, Will Schipp, Mahmoud Ben Hassine, Parikshit Dutta
  • Method Details

    • getJobInstances

      List<JobInstance> getJobInstances(String jobName, int start, int count)
      Fetch JobInstance values in descending order of creation (and, therefore, usually, of first execution).
      Parameters:
      jobName - The name of the job to query.
      start - The start index of the instances to return.
      count - The maximum number of instances to return.
      Returns:
      the JobInstance values up to a maximum of count values.
    • getLastJobInstance

      @Nullable default JobInstance getLastJobInstance(String jobName)
      Find the last job instance, by ID, for the given job.
      Parameters:
      jobName - The name of the job.
      Returns:
      the last job instance by Id if any or null otherwise.
      Since:
      4.2
    • getJobExecution

      @Nullable JobExecution getJobExecution(@Nullable Long executionId)
      Retrieve a JobExecution by its ID. The complete object graph for this execution should be returned (unless otherwise indicated), including the parent JobInstance and associated ExecutionContext and StepExecution instances (also including their execution contexts).
      Parameters:
      executionId - The job execution ID.
      Returns:
      the JobExecution that has this ID or null if not found.
    • getStepExecution

      @Nullable StepExecution getStepExecution(@Nullable Long jobExecutionId, @Nullable Long stepExecutionId)
      Retrieve a StepExecution by its ID and parent JobExecution ID. The execution context for the step should be available in the result, and the parent job execution should have its primitive properties, but it may not contain the job instance information.
      Parameters:
      jobExecutionId - The parent job execution ID.
      stepExecutionId - The step execution ID.
      Returns:
      the StepExecution that has this ID or null if not found.
      See Also:
    • getJobInstance

      @Nullable JobInstance getJobInstance(@Nullable Long instanceId)
      Parameters:
      instanceId - Long The ID for the JobInstance to obtain.
      Returns:
      the JobInstance that has this ID, or null if not found.
    • getJobInstance

      @Nullable default JobInstance getJobInstance(String jobName, JobParameters jobParameters)
      Parameters:
      jobName - String name of the job.
      jobParameters - JobParameters parameters for the job instance.
      Returns:
      the JobInstance with the given name and parameters, or null.
      Since:
      5.0
    • getJobExecutions

      List<JobExecution> getJobExecutions(JobInstance jobInstance)
      Retrieve job executions by their job instance. The corresponding step executions may not be fully hydrated (for example, their execution context may be missing), depending on the implementation. In that case, use getStepExecution(Long, Long) to hydrate them.
      Parameters:
      jobInstance - The JobInstance to query.
      Returns:
      the list of all executions for the specified JobInstance.
    • getLastJobExecution

      @Nullable default JobExecution getLastJobExecution(JobInstance jobInstance)
      Find the last JobExecution that has been created for a given JobInstance.
      Parameters:
      jobInstance - The JobInstance for which to find the last JobExecution.
      Returns:
      the last JobExecution that has been created for this instance or null if no job execution is found for the given job instance.
      Since:
      4.2
    • findRunningJobExecutions

      Set<JobExecution> findRunningJobExecutions(@Nullable String jobName)
      Retrieve running job executions. The corresponding step executions may not be fully hydrated (for example, their execution context may be missing), depending on the implementation. In that case, use getStepExecution(Long, Long) to hydrate them.
      Parameters:
      jobName - The name of the job.
      Returns:
      the set of running executions for jobs with the specified name.
    • getJobNames

      List<String> getJobNames()
      Query the repository for all unique JobInstance names (sorted alphabetically).
      Returns:
      the list of job names that have been executed.
    • findJobInstancesByJobName

      List<JobInstance> findJobInstancesByJobName(String jobName, int start, int count)
      Fetch JobInstance values in descending order of creation (and, therefore, usually of first execution) with a 'like' or wildcard criteria.
      Parameters:
      jobName - The name of the job for which to query.
      start - The start index of the instances to return.
      count - The maximum number of instances to return.
      Returns:
      a list of JobInstance for the requested job name.
    • getJobInstanceCount

      long getJobInstanceCount(@Nullable String jobName) throws NoSuchJobException
      Query the repository for the number of unique JobInstance objects associated with the supplied job name.
      Parameters:
      jobName - The name of the job for which to query.
      Returns:
      the number of JobInstances that exist within the associated job repository.
      Throws:
      NoSuchJobException - thrown when there is no JobInstance for the jobName specified.