Class NodeStatusPersistence
java.lang.Object
com.nt.udc.nodemgr.shutdown.persistence.NodeStatusPersistence
Manages the persistence of node statuses before a shutdown event.
This class stores the status of running nodes in a JSON file, which can be retrieved later
to restore the previous state of the nodes.
-
Constructor Summary
ConstructorsConstructorDescriptionNodeStatusPersistence(Path configFile, com.nt.udc.nodemgr.OSANodeMgr nodeMgr) -
Method Summary
Modifier and TypeMethodDescriptionbooleanPersists the statuses of all running nodes before shutting them down.booleanResumes all nodes that were paused before shutdown by reading their statuses from the persisted configuration file.
-
Constructor Details
-
NodeStatusPersistence
-
-
Method Details
-
pauseNodesForShutdown
public boolean pauseNodesForShutdown()Persists the statuses of all running nodes before shutting them down.The method retrieves the list of nodes from the node manager and filters out nodes that are running. It then serializes their statuses to a JSON file specified by
configFile.- Returns:
trueif the node statuses were successfully persisted,falseotherwise.
-
resumePausedNodes
Resumes all nodes that were paused before shutdown by reading their statuses from the persisted configuration file.The method deserializes the JSON file containing the statuses of the nodes that were running before shutdown, and attempts to resume each paused node.
- Returns:
trueif all paused nodes were successfully resumed,falseotherwise.- Throws:
BulkOpException- if there is a failure in resuming multiple nodes at once.
-