com.atlassian.scheduler.config
Class JobRunnerKey
java.lang.Object
com.atlassian.scheduler.config.JobRunnerKey
- All Implemented Interfaces:
- Serializable, Comparable<JobRunnerKey>
@Immutable
@PublicApi
public final class JobRunnerKey
- extends Object
- implements Serializable, Comparable<JobRunnerKey>
A wrapper to distinguish job runner keys from simple strings and to make it easier
to avoid confusing them with Job IDs
- Since:
- v1.0
- See Also:
- Serialized Form
of
public static JobRunnerKey of(@Nonnull
String key)
- Wraps the provided string as a
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);
}
- Parameters:
key - the job runner key, as a string
- Returns:
- the wrapped job runner key
equals
public boolean equals(Object o)
- Overrides:
equals in class Object
compareTo
public int compareTo(JobRunnerKey o)
- Specified by:
compareTo in interface Comparable<JobRunnerKey>
hashCode
public int hashCode()
- Overrides:
hashCode in class Object
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2014 Atlassian. All Rights Reserved.