@PublicApi public enum RunMode extends Enum<RunMode>
This mostly defines how a job will run in a clustered environment; however, it also affects whether or not the job will survive a restart of the underlying application.
| Enum Constant and Description |
|---|
RUN_LOCALLY
The job is scheduled such that it will apply only to this particular node of the cluster.
|
RUN_ONCE_PER_CLUSTER
The job is scheduled such that it will only run on one node of the cluster each time that it triggers.
|
| Modifier and Type | Method and Description |
|---|---|
static RunMode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static RunMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final RunMode RUN_ONCE_PER_CLUSTER
Although jobs scheduled with this run mode must still register the JobRunner for the job on each restart,
the job's schedule will persist across restarts.
Note: this RunMode is susceptible to a race condition which may allow a job to run concurrently on
multiple nodes. In most cases this can be avoided by scheduling a job with a short inital delay (see
scheduleJob's Javadoc for more
details). However, for long running jobs, a cluster-wide lock should be acquired inside the
job.
public static final RunMode RUN_LOCALLY
This job will not be persisted, and the job must be recreated if the application is restarted.
public static RunMode[] values()
for (RunMode c : RunMode.values()) System.out.println(c);
public static RunMode valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullCopyright © 2018 Atlassian. All rights reserved.