Interface IgniteServer


public interface IgniteServer
Embedded Ignite node. Manages node's lifecycle, provides Ignite API and allows cluster initialization.

NOTE: Methods of this interface are not thread-safe and shouldn't be called from different threads.

  • Method Details

    • startAsync

      static CompletableFuture<IgniteServer> startAsync(String nodeName, Path configPath, Path workDir)
      Starts an embedded Ignite node with a configuration from a HOCON file.

      When the future returned from this method completes, the node is partially started, and is ready to accept the init command (that is, its REST endpoint is functional).

      Parameters:
      nodeName - Name of the node. Must not be null.
      configPath - Path to the node configuration in the HOCON format. Must not be null.
      workDir - Work directory for the node. Must not be null.
      Returns:
      Future that will be completed when the node is partially started, and is ready to accept the init command (that is, its REST endpoint is functional).
    • startAsync

      CompletableFuture<Void> startAsync()
      Starts the node.

      When the returned future completes, the node is partially started and ready to accept the init command (that is, its REST endpoint is functional).

      Start can only be called once.

      Returns:
      Future that will be completed when the node is started.
    • start

      static IgniteServer start(String nodeName, Path configPath, Path workDir)
      Starts an embedded Ignite node with a configuration from a HOCON file synchronously.

      When this method returns, the node is partially started, and is ready to accept the init command (that is, its REST endpoint is functional).

      Parameters:
      nodeName - Name of the node. Must not be null.
      configPath - Path to the node configuration in the HOCON format. Must not be null.
      workDir - Work directory for the node. Must not be null.
      Returns:
      Node instance.
    • start

      void start()
      Starts the node.

      When this method returns, the node is partially started and ready to accept the init command (that is, its REST endpoint is functional).

      Start can only be called once.

    • builder

      static IgniteServer.Builder builder(String nodeName, Path configPath, Path workDir)
      Returns a builder for an embedded Ignite node.
      Parameters:
      nodeName - Name of the node. Must not be null.
      configPath - Path to the node configuration in the HOCON format. Must not be null.
      workDir - Work directory for the node. Must not be null.
      Returns:
      Node instance.
    • api

      Ignite api()
      Returns the Ignite API. The API is available when the node has joined an initialized cluster. This method throws a ClusterNotInitializedException if the cluster is not yet initialized.
      Returns:
      Ignite API facade.
    • initClusterAsync

      CompletableFuture<Void> initClusterAsync(InitParameters parameters)
      Initializes the cluster that the given node is present in.

      Cluster initialization propagates information about those nodes that will host the Meta Storage and CMG Raft groups to all nodes in the cluster. After the operation succeeds, nodes can finish the start procedure and begin accepting incoming requests.

      Meta Storage is responsible for storing cluster-wide meta information required for internal purposes and proper functioning of the cluster.

      Cluster Management Group (CMG) is a Raft group responsible for managing parts of the cluster lifecycle, such as validating incoming nodes and maintaining logical topology.

      Parameters:
      parameters - initialization parameters.
      Returns:
      CompletableFuture that resolves after all components are started and the cluster initialization is complete and the node has joined the logical topology.
      Throws:
      IgniteException - If the given node has not been started or has been stopped.
      See Also:
    • initCluster

      void initCluster(InitParameters parameters)
      Initializes the cluster that the given node is present in synchronously.

      Cluster initialization propagates information about those nodes that will host the Meta Storage and CMG Raft groups to all nodes in the cluster. After the operation succeeds, nodes can finish the start procedure and begin accepting incoming requests.

      Meta Storage is responsible for storing cluster-wide meta information required for internal purposes and proper functioning of the cluster.

      Cluster Management Group (CMG) is a Raft group responsible for managing parts of the cluster lifecycle, such as validating incoming nodes and maintaining logical topology.

      When this method returns, the node is started, the cluster initialization is complete and the node has joined the logical topology.

      Parameters:
      parameters - initialization parameters.
      Throws:
      IgniteException - If the given node has not been started or has been stopped.
      See Also:
    • waitForInitAsync

      CompletableFuture<Void> waitForInitAsync()
      Waits for the cluster initialization. Used when the initialization is done externally (for example, via REST endpoint).
      Returns:
      CompletableFuture that resolves when the cluster initialization is complete and the node has joined the logical topology.
    • shutdownAsync

      CompletableFuture<Void> shutdownAsync()
      Stops the node. After the future returned by method completes, the node is no longer functional and can't be restarted. Use startAsync methods to create new IgniteServer instance.
      Returns:
      CompletableFuture that resolves when the node is stopped.
    • shutdown

      void shutdown()
      Stops the node synchronously. After this method completes, the node is no longer functional and can't be restarted. Use startAsync methods to create new IgniteServer instance.
    • name

      String name()
      Returns node name.
      Returns:
      Node name.