com.hazelcast.jet.server

## Class JetBootstrap

- java.lang.Object
- - com.hazelcast.jet.server.JetBootstrap

-     public final class JetBootstrap
      extends Object

  A helper class that allows one to create a standalone runnable JAR which contains all the code needed to submit a job to a running Jet cluster. The main issue with achieving this is that the JAR must be attached as a resource to the job being submitted, so the Jet cluster will be able to load and use its classes. However, from within a running `main()` method it is not trivial to find out the filename of the JAR containing it.

  This helper is a part of the solution to the above "bootstrapping" issue. To use it, follow these steps:

  1. Write your `main()` method and your Jet code the usual way, except for calling `getInstance()` to acquire a Jet client instance (instead of `Jet.newJetClient()`).
  2. Create a runnable JAR with your entry point declared as the `Main-Class` in `MANIFEST.MF`.
  3. Run your JAR, but instead of `java -jar jetjob.jar` use `jet.sh submit jetjob.jar`. The script is found in the Jet distribution zipfile, in the `bin` directory. On Windows use `jet.bat`.
  4. The Jet client will be configured from `hazelcast-client.xml` found in the `config` directory in Jet's distribution directory structure. Adjust that file to suit your needs.

  For example, write a class like this:

       public class CustomJetJob {
         public static void main(String[] args) {
           JetInstance jet = JetBootstrap.getInstance();
           jet.newJob(buildDag()).execute().get();
         }

         public static DAG buildDag() {
             // ...
         }
       }

  After building the JAR, submit the job:

       $ jet.sh submit jetjob.jar

  Since:
    3.0

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JetInstance` | `getInstance()` Returns the bootstrapped `JetInstance`.

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

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

- - ### Method Detail

    - #### getInstance

          public static JetInstance getInstance()

      Returns the bootstrapped `JetInstance`. The instance will be automatically shut down once the `main()` method of the JAR returns.

Copyright © 2019. All rights reserved.