com.hazelcast.jet.config

## Class JobConfig

- java.lang.Object
- - com.hazelcast.jet.config.JobConfig

- All Implemented Interfaces:
    Serializable

      public class JobConfig
      extends Object
      implements Serializable

  Contains the configuration specific to one Hazelcast Jet job.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JobConfig()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JobConfig

          public JobConfig()

  - ### Method Detail

    - #### getName

          @Nullable
          public String getName()

      Returns the name of the job or `null` if no name was given.

    - #### setName

          @Nonnull
          public JobConfig setName(@Nullable
                                            String name)

      Sets the name for the job. Job names do not have to be unique but it's good to keep them unique to be able to distinguish them in logs and the Management Center.

      The default value is `null`.

      Returns:
        `this` instance for fluent API

    - #### isSplitBrainProtectionEnabled

          public boolean isSplitBrainProtectionEnabled()

      Tells whether `split brain protection` is enabled.

    - #### setSplitBrainProtection

          @Nonnull
          public JobConfig setSplitBrainProtection(boolean isEnabled)

      Configures the split brain protection feature. When enabled, Jet will restart the job after a topology change only if the cluster quorum is satisfied. The quorum value is

      `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.

      Returns:
        `this` instance for fluent API

    - #### setAutoScaling

          public JobConfig setAutoScaling(boolean enabled)

      Sets whether Jet will scale the job up or down when a member is added or removed from the cluster.

           +--------------------------+-----------------------+----------------+
           |       Auto scaling       |     Member added      | Member removed |
           +--------------------------+-----------------------+----------------+
           | Enabled                  | restart (after delay) | restart        |
           | Disabled - snapshots on  | no action             | suspend        |
           | Disabled - snapshots off | no action             | fail           |
           +--------------------------+-----------------------+----------------+

      Returns:
        `this` instance for fluent API
      See Also:
        `Configuring the scale-up delay`, `Enabling/disabling snapshots`

    - #### isAutoScaling

          public boolean isAutoScaling()

      Returns whether auto scaling is enabled, see `setAutoScaling(boolean)`.

    - #### getProcessingGuarantee

          @Nonnull
          public ProcessingGuarantee getProcessingGuarantee()

      Returns the configured `processing guarantee`.

    - #### setProcessingGuarantee

          @Nonnull
          public JobConfig setProcessingGuarantee(@Nonnull
                                                           ProcessingGuarantee processingGuarantee)

      Set the `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`.

      Returns:
        `this` instance for fluent API

    - #### getSnapshotIntervalMillis

          public long getSnapshotIntervalMillis()

      Returns the configured `snapshot interval`.

    - #### setSnapshotIntervalMillis

          @Nonnull
          public 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. Must be set to a positive value. This setting is only relevant with at-least-once or exactly-once processing guarantees.

      Default value is set to 10 seconds.

      Returns:
        `this` instance for fluent API

    - #### setMaxWatermarkRetainMillis

          @Nonnull
          public JobConfig setMaxWatermarkRetainMillis(int retainMillis)

      Sets the maximum time to retain the watermarks while coalescing them. A negative value disables the limit and Jet will retain the watermark as long as needed. With this setting you choose a trade-off between latency and correctness that arises when dealing with stream skew.

      ### Stream Skew

      The skew between two slices of a distributed stream is defined as the difference in their watermark values. There is always some skew in the system and it's acceptable, but it can grow very large due to various causes such as a hiccup on one of the cluster members (a long GC pause), external source hiccup on a member, skew between partitions of a distributed source, and so on.

      ### Detrimental Effects of Stream Skew

      To maintain full correctness, Jet must wait indefinitely for the watermark to advance in all the slices of the stream in order to advance the overall watermark. The process that does this is called watermark coalescing and it results in increased latency of the output with respect to the input and possibly also increased memory usage due to the retention of all the pending data.

      ### Detrimental Effects of Limiting Retention Time

      Limiting the watermark retention time allows it to advance, and therefore the processing to continue, in the face of exceedingly large stream skew. However, since any event with a timestamp less than the current watermark is categorized as a late event and dropped, this limit can result in data loss.
      Parameters:
        `retainMillis` - maximum time to retain watermarks for delayed queues or -1 to disable (the default)
      Returns:
        `this` instance for fluent API

    - #### getMaxWatermarkRetainMillis

          public int getMaxWatermarkRetainMillis()

      Returns the maximum watermark retention time, see `setMaxWatermarkRetainMillis(int)`.

    - #### addClass

          @Nonnull
          public JobConfig addClass(@Nonnull
                                             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.
      Returns:
        `this` instance for fluent API

    - #### addJar

          @Nonnull
          public JobConfig addJar(@Nonnull
                                           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.
      Returns:
        `this` instance for fluent API

    - #### addJar

          @Nonnull
          public JobConfig addJar(@Nonnull
                                           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. The JAR filename will be used as the ID of the resource.
      Returns:
        `this` instance for fluent API

    - #### addJar

          @Nonnull
          public JobConfig addJar(@Nonnull
                                           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. The JAR filename will be used as the ID of the resource.
      Returns:
        `this` instance for fluent API

    - #### addResource

          @Nonnull
          public JobConfig addResource(@Nonnull
                                                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. The resource's filename will be used as its ID.
      Returns:
        `this` instance for fluent API

    - #### addResource

          @Nonnull
          public JobConfig addResource(@Nonnull
                                                URL url,
                                                @Nonnull
                                                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. The resource will be registered under the supplied ID.
      Returns:
        `this` instance for fluent API

    - #### addResource

          @Nonnull
          public JobConfig addResource(@Nonnull
                                                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. The resource's filename will be used as its ID.
      Returns:
        `this` instance for fluent API

    - #### addResource

          @Nonnull
          public JobConfig addResource(@Nonnull
                                                File file,
                                                @Nonnull
                                                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. The resource will be registered under the supplied ID.
      Returns:
        `this` instance for fluent API

    - #### addResource

          @Nonnull
          public JobConfig addResource(@Nonnull
                                                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. The resource's filename will be used as its ID.
      Returns:
        `this` instance for fluent API

    - #### addResource

          @Nonnull
          public JobConfig addResource(@Nonnull
                                                String path,
                                                @Nonnull
                                                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. The resource will be registered under the supplied ID.
      Returns:
        `this` instance for fluent API

    - #### getResourceConfigs

          @Nonnull
          public List<ResourceConfig> getResourceConfigs()

      Returns all the registered resource configurations.

    - #### setClassLoaderFactory

          public JobConfig setClassLoaderFactory(@Nullable
                                                 JobClassLoaderFactory classLoaderFactory)

      Sets a custom `JobClassLoaderFactory` that will be used to load job classes and resources on Jet members.
      Returns:
        `this` instance for fluent API

    - #### getClassLoaderFactory

          @Nullable
          public JobClassLoaderFactory getClassLoaderFactory()

      Returns the configured `JobClassLoaderFactory`.

Copyright © 2018. All rights reserved.