View Javadoc

1   package com.atlassian.scheduler.status;
2   
3   import com.atlassian.annotations.PublicApi;
4   import com.atlassian.scheduler.JobRunnerResponse;
5   
6   import javax.annotation.Nonnull;
7   import java.util.Date;
8   
9   /**
10   * A report of the result from a specific attempt to run a job.  The job status may optionally also include
11   * a {@link #getMessage() status message} for informational or troubleshooting reasons.
12   *
13   * @since v1.0
14   */
15  @PublicApi
16  public interface RunDetails {
17      /**
18       * The maximum length that is permitted for the message string returned in a {@link JobRunnerResponse}.
19       * Any return value that exceeds this length ({@value} {@code char}s) is silently truncated.
20       */
21      int MAXIMUM_MESSAGE_LENGTH = 255;
22  
23  
24      /**
25       * Returns the starting time of this job run.
26       *
27       * @return the starting time of this job run.
28       */
29      @Nonnull
30      Date getStartTime();
31  
32      /**
33       * Returns the duration (in milliseconds) that the job took to complete.
34       *
35       * @return the duration (in milliseconds) that the job took to complete.
36       */
37      long getDurationInMillis();
38  
39      /**
40       * Returns the overall result of the job
41       *
42       * @return the overall result of the job
43       */
44      @Nonnull
45      RunOutcome getRunOutcome();
46  
47      /**
48       * Returns any additional message that the job would like to report about this job run.  If the job failed,
49       * this will generally include a brief summary of the exception that was thrown.  This may be blank for
50       * successful statuses, but it will never be {@code null}.
51       *
52       * @return any additional message that the job would like to report about its status.
53       */
54      @Nonnull
55      String getMessage();
56  }