|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.scheduler.config.JobConfig
@Immutable @PublicApi public final class JobConfig
Configuration options available when scheduling a job to be run. This is similar to
JobDetails, but provides only the information that is relevant to configuring
the job or for the job to reference when it is actually running.
JobDetails| Method Summary | |
|---|---|
boolean |
equals(Object o)
|
static JobConfig |
forJobRunnerKey(JobRunnerKey jobRunnerKey)
Creates a new job configuration for the specified job runner key. |
JobRunnerKey |
getJobRunnerKey()
|
Map<String,Serializable> |
getParameters()
|
RunMode |
getRunMode()
|
Schedule |
getSchedule()
|
int |
hashCode()
|
String |
toString()
|
JobConfig |
withParameters(Map<String,Serializable> parameters)
Returns a copy of this job config that will use the specified parameters instead of what it currently uses. |
JobConfig |
withRunMode(RunMode runMode)
Returns a copy of this job config that will use the specified run mode instead of what it currently uses. |
JobConfig |
withSchedule(Schedule schedule)
Returns a copy of this job config that will use the specified schedule instead of what it currently uses. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static JobConfig forJobRunnerKey(JobRunnerKey jobRunnerKey)
By default, the job configuration will assume:
withRunMode(RunMode.RUN_ONCE_PER_CLUSTER)withSchedule(Schedule.runOnce(new Date()))withParameters(null)
Any of which may be overridden by calling the appropriate method. Note that chaining the
methods is recommended, as these methods return an altered copy rather than modifiying the
original JobConfig in place. For example, use:
JobConfig config = JobConfig.forJobRunnerKey("myJobToDoImportantThings")
.withSchedule(Schedule.forInterval(Date, long))
.withRunMode(RunMode.RUN_LOCALLY);
jobRunnerKey - the unique identifier used to
register
the JobRunner
@Nonnull public JobRunnerKey getJobRunnerKey()
@Nonnull public RunMode getRunMode()
@Nonnull public Schedule getSchedule()
@Nonnull public Map<String,Serializable> getParameters()
public JobConfig withRunMode(RunMode runMode)
runMode - the new run mode; may be null, in which case the default
RunMode.RUN_ONCE_PER_CLUSTER is used
public JobConfig withSchedule(Schedule schedule)
schedule - the new schedule; may be null, in which case the default
runOnce(new Date()) is used
public JobConfig withParameters(Map<String,Serializable> parameters)
WARNING: The parameters map must be serializable, so all of its
contents must be as well. Using objects that are not serializable, even as data
members of objects that are themselves serializable, will usually fail. Developers
are encouraged to limit the information stored here to a few simple keys for
accessing the runtime data that is needed instead of storing large objects,
injectable components, etc. in the parameters map.
WARNING: The scheduler service assumes that the objects within the
parameters map are immutable. Modifying objects after they have been added
to the parameters map may have unpredictable results.
parameters - the new parameters; may be null, in which case the
JobRunner is provided with an empty map at run time. The map
should contain only immutable, serializable data
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||