1 package com.atlassian.sal.api.scheduling;
2
3 import java.util.Date;
4 import java.util.Map;
5
6 /**
7 * Interface for scheduling jobs
8 *
9 * @since 2.0
10 */
11 public interface PluginScheduler
12 {
13 /**
14 * Schedule the given job.
15 *
16 * <p> <strong>WARNING</strong>: it is very important not to try to call this method until the underlying application
17 * is fully started. You should implement {@link com.atlassian.sal.api.lifecycle.LifecycleAware} and call scheduleJob()
18 * only on {@link com.atlassian.sal.api.lifecycle.LifecycleAware#onStart()}
19 *
20 * @param jobKey A unique key of the job
21 * @param jobClass The class for the job
22 * @param jobDataMap Any data that needs to be passed to the job. This map instance will always be the same
23 * instance that is given to the job when it executes.
24 * @param startTime The time the job is to start.
25 * @param repeatInterval How long the interval between repeats, in milliseconds. Note, some implementations
26 */
27 void scheduleJob(String jobKey,
28 Class<? extends PluginJob> jobClass, Map<String, Object> jobDataMap,
29 Date startTime, long repeatInterval);
30
31 /**
32 * Unschedule the given job. If the job doesn't exist then IllegalArgumentException will be thrown.
33 *
34 * @param jobKey The job key to unschedule
35 * @throws IllegalArgumentException If the job doesn't exist thus cannot be unscheduled.
36 */
37 void unscheduleJob(String jobKey);
38 }