Interface IgniteServer
NOTE: Methods of this interface are not thread-safe and shouldn't be called from different threads.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final class
Builder for IgniteServer. -
Method Summary
Modifier and TypeMethodDescriptionapi()
Returns the Ignite API.static IgniteServer.Builder
Returns a builder for an embedded Ignite node.void
initCluster
(InitParameters parameters) Initializes the cluster that the given node is present in synchronously.initClusterAsync
(InitParameters parameters) Initializes the cluster that the given node is present in.name()
Returns node name.void
shutdown()
Stops the node synchronously.Stops the node.void
start()
Starts the node.static IgniteServer
Starts an embedded Ignite node with a configuration from a HOCON file synchronously.Starts the node.static CompletableFuture<IgniteServer>
startAsync
(String nodeName, Path configPath, Path workDir) Starts an embedded Ignite node with a configuration from a HOCON file.Waits for the cluster initialization.
-
Method Details
-
startAsync
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 benull
.configPath
- Path to the node configuration in the HOCON format. Must not benull
.workDir
- Work directory for the node. Must not benull
.- 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
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 benull
.configPath
- Path to the node configuration in the HOCON format. Must not benull
.workDir
- Work directory for the node. Must not benull
.- 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
Returns a builder for an embedded Ignite node.- Parameters:
nodeName
- Name of the node. Must not benull
.configPath
- Path to the node configuration in the HOCON format. Must not benull
.workDir
- Work directory for the node. Must not benull
.- 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 aClusterNotInitializedException
if the cluster is not yet initialized.- Returns:
- Ignite API facade.
-
initClusterAsync
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
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. UsestartAsync
methods to create newIgniteServer
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. UsestartAsync
methods to create newIgniteServer
instance. -
name
String name()Returns node name.- Returns:
- Node name.
-