@Immutable @PublicApi public final class JobRunnerKey extends Object implements Serializable, Comparable<JobRunnerKey>
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(JobRunnerKey o) |
boolean |
equals(Object o) |
int |
hashCode() |
static JobRunnerKey |
of(String key)
Wraps the provided string as a
JobRunnerKey. |
String |
toString() |
public static JobRunnerKey of(String key)
JobRunnerKey.
Although it is not necessary for correctness, it will usually make sense to create a single instance of
the JobRunnerKey and reuse it as a constant, as in:
private static final JobRunnerKey POP3_SERVICE = JobRunnerKey.of("com.example.plugin.Pop3Service");
// ...
private void registerJobRunner()
{
schedulerService.registerJobRunner(POP3_SERVICE, new Pop3JobRunner());
}
private String scheduleJobWithGeneratedId(String cronExpression)
{
JobConfig jobConfig = JobConfig.forJobRunnerKey(POP3_SERVICE)
.withSchedule(Schedule.forCronExpression(cronExpression));
return schedulerService.scheduleJobWithGeneratedId(jobConfig);
}
key - the job runner key, as a stringpublic int compareTo(JobRunnerKey o)
compareTo in interface Comparable<JobRunnerKey>Copyright © 2017 Atlassian. All rights reserved.