@Immutable @PublicApi public final class JobConfig extends Object
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| Modifier and Type | Method and Description |
|---|---|
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.
|
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);
@Nonnull public JobRunnerKey getJobRunnerKey()
@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 usedpublic JobConfig withSchedule(Schedule schedule)
schedule - the new schedule; may be null, in which case the default
runOnce(new Date()) is usedpublic JobConfig withParameters(@Nullable 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 dataCopyright © 2017 Atlassian. All rights reserved.