View Javadoc

1   package com.atlassian.scheduler.core.spi;
2   
3   import com.atlassian.scheduler.config.JobId;
4   import com.atlassian.scheduler.status.RunDetails;
5   
6   import javax.annotation.CheckForNull;
7   
8   /**
9    * Service provided by the host application to persist {@code RunDetails} objects.
10   *
11   * @since v1.0
12   */
13  public interface RunDetailsDao {
14      /**
15       * Returns the result of the most recent attempt to run this job.
16       *
17       * @param jobId the job ID of interest
18       * @return the result information for the most recent run attempt, or {@code null} if there
19       * is no recorded run history for this job
20       */
21      @CheckForNull
22      RunDetails getLastRunForJob(JobId jobId);
23  
24      /**
25       * Returns the result of the most recent successful run of this job.
26       *
27       * @param jobId the job ID of interest
28       * @return the result information for the most recent run attempt, or {@code null} if there
29       * is no successful result recorded for this job
30       */
31      @CheckForNull
32      RunDetails getLastSuccessfulRunForJob(JobId jobId);
33  
34      /**
35       * Records the result of an attempt to run the specified job.
36       *
37       * @param jobId      the job ID of the job that the scheduler attempted to run
38       * @param runDetails the result of the run
39       */
40      void addRunDetails(JobId jobId, RunDetails runDetails);
41  }