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.
|
JobClassLoaderFactory |
getClassLoaderFactory()
Returns the configured
JobClassLoaderFactory . |
int |
getMaxWatermarkRetainMillis()
Returns the maximum watermark retention time, see
setMaxWatermarkRetainMillis(int) . |
String |
getName()
Returns the name of the job or
null if no name was given. |
ProcessingGuarantee |
getProcessingGuarantee()
Returns the configured
processing guarantee . |
List<ResourceConfig> |
getResourceConfigs()
Returns all the registered resource configurations.
|
long |
getSnapshotIntervalMillis()
Returns the configured
snapshot interval . |
boolean |
isAutoScaling()
Returns whether auto scaling is enabled, see
setAutoScaling(boolean) . |
boolean |
isSplitBrainProtectionEnabled()
Tells whether
split brain protection
is enabled. |
JobConfig |
setAutoScaling(boolean enabled)
Sets whether Jet will scale the job up or down when a member is added or
removed from the cluster.
|
JobConfig |
setClassLoaderFactory(JobClassLoaderFactory classLoaderFactory)
Sets a custom
JobClassLoaderFactory that will be used to load
job classes and resources on Jet members. |
JobConfig |
setMaxWatermarkRetainMillis(int retainMillis)
Sets the maximum time to retain the watermarks while coalescing them.
|
JobConfig |
setName(String name)
Sets the name for the job.
|
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.
|
@Nonnull public JobConfig setName(@Nullable String name)
The default value is null
.
this
instance for fluent APIpublic boolean isSplitBrainProtectionEnabled()
split brain protection
is enabled.@Nonnull 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.
If auto scaling is disabled and
you manually Job.resume()
the job, the job won't start executing
until the quorum is met, but will remain in the resumed state.
this
instance for fluent APIpublic JobConfig setAutoScaling(boolean enabled)
+--------------------------+-----------------------+----------------+ | Auto scaling | Member added | Member removed | +--------------------------+-----------------------+----------------+ | Enabled | restart (after delay) | restart | | Disabled - snapshots on | no action | suspend | | Disabled - snapshots off | no action | fail | +--------------------------+-----------------------+----------------+
this
instance for fluent APIConfiguring the scale-up delay
,
Enabling/disabling snapshots
public boolean isAutoScaling()
setAutoScaling(boolean)
.@Nonnull public ProcessingGuarantee getProcessingGuarantee()
processing guarantee
.@Nonnull public JobConfig setProcessingGuarantee(@Nonnull 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
.
this
instance for fluent APIpublic long getSnapshotIntervalMillis()
snapshot interval
.@Nonnull public JobConfig setSnapshotIntervalMillis(long snapshotInterval)
Default value is set to 10 seconds.
this
instance for fluent API@Nonnull public JobConfig setMaxWatermarkRetainMillis(int retainMillis)
retainMillis
- maximum time to retain watermarks for delayed queues
or -1 to disable (the default)this
instance for fluent APIpublic int getMaxWatermarkRetainMillis()
setMaxWatermarkRetainMillis(int)
.@Nonnull public JobConfig addClass(@Nonnull Class... classes)
this
instance for fluent API@Nonnull public JobConfig addJar(@Nonnull URL url)
this
instance for fluent API@Nonnull public JobConfig addJar(@Nonnull File file)
this
instance for fluent API@Nonnull public JobConfig addJar(@Nonnull String path)
this
instance for fluent API@Nonnull public JobConfig addResource(@Nonnull URL url)
this
instance for fluent API@Nonnull public JobConfig addResource(@Nonnull URL url, @Nonnull String id)
this
instance for fluent API@Nonnull public JobConfig addResource(@Nonnull File file)
this
instance for fluent API@Nonnull public JobConfig addResource(@Nonnull File file, @Nonnull String id)
this
instance for fluent API@Nonnull public JobConfig addResource(@Nonnull String path)
this
instance for fluent API@Nonnull public JobConfig addResource(@Nonnull String path, @Nonnull String id)
this
instance for fluent API@Nonnull public List<ResourceConfig> getResourceConfigs()
public JobConfig setClassLoaderFactory(@Nullable JobClassLoaderFactory classLoaderFactory)
JobClassLoaderFactory
that will be used to load
job classes and resources on Jet members.this
instance for fluent API@Nullable public JobClassLoaderFactory getClassLoaderFactory()
JobClassLoaderFactory
.Copyright © 2018 Hazelcast, Inc.. All rights reserved.