public class JobConfig extends Object implements Serializable
Constructor and Description |
---|
JobConfig() |
Modifier and Type | Method and Description |
---|---|
JobConfig |
addClass(Class... classes)
Adds the supplied classes to the list of resources that will be
available on the job's classpath while it's executing in the Jet
cluster.
|
JobConfig |
addJar(File file)
Adds the supplied JAR file to the list of JARs that will be a part of
the job's classpath while it's executing in the Jet cluster.
|
JobConfig |
addJar(String path)
Adds the JAR identified by the supplied pathname to the list of JARs
that will be a part of the job's classpath while it's executing in the
Jet cluster.
|
JobConfig |
addJar(URL url)
Adds the JAR identified by the supplied URL to the list of JARs that
will be a part of the job's classpath while it's executing in the Jet
cluster.
|
JobConfig |
addResource(File file)
Adds the supplied file to the list of resources that will be on the
job's classpath while it's executing in the Jet cluster.
|
JobConfig |
addResource(File file,
String id)
Adds the supplied file to the list of resources that will be on the
job's classpath while it's executing in the Jet cluster.
|
JobConfig |
addResource(String path)
Adds the resource identified by the supplied pathname to the list of
resources that will be on the job's classpath while it's executing in
the Jet cluster.
|
JobConfig |
addResource(String path,
String id)
Adds the resource identified by the supplied pathname to the list of
resources that will be on the job's classpath while it's executing in
the Jet cluster.
|
JobConfig |
addResource(URL url)
Adds the resource identified by the supplied URL to the list of
resources that will be on the job's classpath while it's executing in
the Jet cluster.
|
JobConfig |
addResource(URL url,
String id)
Adds the resource identified by the supplied URL to the list of
resources that will be on the job's classpath while it's executing in
the Jet cluster.
|
ProcessingGuarantee |
getProcessingGuarantee()
Returns the configured
processing guarantee . |
List<ResourceConfig> |
getResourceConfigs()
Returns all the registered resource configurations.
|
long |
getSnapshotIntervalMillis()
Returns the configured
snapshot interval . |
boolean |
isAutoRestartOnMemberFailureEnabled()
Tells whether
auto
restart after member failure is enabled. |
boolean |
isSplitBrainProtectionEnabled()
Tells whether
split brain protection
is enabled. |
JobConfig |
setAutoRestartOnMemberFailure(boolean isEnabled)
Sets whether the job should automatically restart after a
participating member leaves the cluster.
|
JobConfig |
setProcessingGuarantee(ProcessingGuarantee processingGuarantee)
Set the
processing guarantee for the job. |
JobConfig |
setSnapshotIntervalMillis(long snapshotInterval)
Sets the snapshot interval in milliseconds — the interval between
the completion of the previous snapshot and the start of a new one.
|
JobConfig |
setSplitBrainProtection(boolean isEnabled)
Configures the split brain protection feature.
|
public boolean isSplitBrainProtectionEnabled()
split brain protection
is enabled.public JobConfig setSplitBrainProtection(boolean isEnabled)
cluster size at job submission time / 2 + 1
.
The job can be restarted only if the size of the cluster after restart is at least the quorum value. Only one of the clusters formed due to a split-brain condition can satisfy the quorum. For example, if at the time of job submission the cluster size was 5 and a network partition causes two clusters with sizes 3 and 2 to form, the job will restart only on the cluster with size 3.
Adding new nodes to the cluster after starting the job may defeat this mechanism. For instance, if there are 5 members at submission time (i.e., the quorum value is 3) and later a new node joins, a split into two clusters of size 3 will allow the job to be restarted on both sides.
Split-brain protection is disabled by default.
This setting has no effect if
auto restart on member
failure
is disabled.
public boolean isAutoRestartOnMemberFailureEnabled()
auto
restart after member failure
is enabled.public JobConfig setAutoRestartOnMemberFailure(boolean isEnabled)
If snapshotting is enabled, the job state will be restored from the latest snapshot.
By default, auto-restart is enabled.
public ProcessingGuarantee getProcessingGuarantee()
processing guarantee
.public JobConfig setProcessingGuarantee(ProcessingGuarantee processingGuarantee)
processing guarantee
for the job.
When the processing guarantee is set to at-least-once or
exactly-once, the snapshot interval can be configured via
setSnapshotIntervalMillis(long)
, otherwise it will default to
10 seconds.
The default value is ProcessingGuarantee.NONE
.
public long getSnapshotIntervalMillis()
snapshot interval
.public JobConfig setSnapshotIntervalMillis(long snapshotInterval)
Default value is set to 10 seconds.
public JobConfig addClass(Class... classes)
public JobConfig addJar(URL url)
public JobConfig addJar(File file)
public JobConfig addJar(String path)
public JobConfig addResource(URL url)
public JobConfig addResource(URL url, String id)
public JobConfig addResource(File file)
public JobConfig addResource(File file, String id)
public JobConfig addResource(String path)
public JobConfig addResource(String path, String id)
public List<ResourceConfig> getResourceConfigs()
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.