sanpwc commented on a change in pull request #230:
URL: https://github.com/apache/ignite-3/pull/230#discussion_r677640568



##########
File path: 
modules/runner/src/main/java/org/apache/ignite/internal/app/IgnitionImpl.java
##########
@@ -256,11 +390,79 @@ private static VaultManager createVault(String nodeName, 
Path workDir) {
 
         var vaultMgr = new VaultManager(new PersistentVaultService(vaultPath));
 
-        vaultMgr.putName(nodeName).join();
-
         return vaultMgr;
     }
 
+    /**
+     * Checks node status. If it's STOPPING then prevents further starting and 
throws NodeStoppingException
+     * that will lead to stopping already started components later on,
+     * otherwise starts component and add it to started components list.
+     *
+     * @param nodeName Node name.
+     * @param startedComponents List of already started components for given 
node.
+     * @param component Ignite component to start.
+     * @param <T> Ignite component type.
+     * @return Started ignite component.
+     * @throws NodeStoppingException If node stopping intention was detected.
+     */
+    private static <T extends IgniteComponent> T doStartComponent(
+        @NotNull String nodeName,
+        @NotNull List<IgniteComponent> startedComponents,
+        @NotNull T component
+    ) throws NodeStoppingException {
+        if (nodesStatus.get(nodeName) == NodeState.STOPPING)
+            throw new NodeStoppingException("Node=[" + nodeName + "] was 
stopped.");
+        else {
+            startedComponents.add(component);
+
+            component.start();
+
+            return component;
+        }
+    }
+
+    /**
+     * Calls {@link IgniteComponent#beforeNodeStop()} and then {@link 
IgniteComponent#stop()} for all components
+     * in start-reverse-order. Cleanups node started components map and node 
status map.
+     *
+     * @param nodeName Node name.
+     * @param startedComponents List of already started components for given 
node.
+     */
+    private static void doStopNode(@NotNull String nodeName, @NotNull 
List<IgniteComponent> startedComponents) {
+        ListIterator<IgniteComponent> componentsonNodeStopIter =

Review comment:
       Fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to