View Javadoc

1   package com.atlassian.scheduler.core;
2   
3   import com.atlassian.scheduler.SchedulerService;
4   
5   /**
6    * An interface that scheduler service implementations will generally be expected to implement
7    * so that they can be stopped from accepting jobs when the application is not at a point in its
8    * lifecycle where it should be running them.  For example, if the plugin system has not finished
9    * coming up, then this node's scheduler should not be claiming jobs, because it would steal
10   * clustered jobs that another node in the cluster would be able to process when we know we are
11   * unlikely to be ready.
12   * <p>
13   * As a general rule, scheduler implementations should begin in {@link #standby()} mode, where
14   * they will not run any jobs until explicitly {@link #start() started}.  Once started, the
15   * scheduler may be placed back into {@code standby} mode and restarted as often as needed.
16   * The {@link #shutdown()} method should only be called when the {@code SchedulerService} is
17   * being disposed and will not be asked to {@code start()} again.
18   * </p>
19   *
20   * @since v1.0
21   */
22  public interface LifecycleAwareSchedulerService extends SchedulerService, SchedulerServiceController {
23  
24      /**
25       * A representation of the scheduler's current state.
26       */
27      enum State {
28          STANDBY,
29          STARTED,
30          SHUTDOWN
31      }
32  }