/// <summary> /// Causes the node to safely shutdown and exit /// </summary> internal void ShutdownNode(NodeShutdownLevel shutdownLevel) { if (shutdownLevel == NodeShutdownLevel.BuildCompleteSuccess || shutdownLevel == NodeShutdownLevel.BuildCompleteFailure) { if (Engine.debugMode) { Console.WriteLine("Node.Shutdown: NodeId " + nodeId + ": Clearing engine state and intern table ready for node re-use."); } if (localEngine != null) { localEngine.EndingEngineExecution (shutdownLevel == NodeShutdownLevel.BuildCompleteSuccess ? true : false, false); localEngine.ResetPerBuildDataStructures(); outProcLoggingService.ProcessPostedLoggingEvents(); buildInProgress = false; } // Clear the static table of interned strings BuildProperty.ClearInternTable(); } else { if (Engine.debugMode) { Console.WriteLine("Node.Shutdown: NodeId " + nodeId + ": Shutting down node due to error."); } // The thread starting the build loop will acquire this lock before starting the loop // in order to read the build requests. Acquiring it here ensures that build loop doesn't // get started between the check for null and setting of the flag lock (buildRequests) { if (localEngine == null) { nodeShutdown = true; } } if (localEngine != null) { // Indicate to the child engine that we need to exit localEngine.SetEngineAbortTo(true); // Wait for the exit event which will be raised once the child engine exits exitNodeEvent.WaitOne(); } } }
/// <summary> /// Causes the node to safely shutdown and exit /// </summary> internal void ShutdownNode(NodeShutdownLevel shutdownLevel) { if (shutdownLevel == NodeShutdownLevel.BuildCompleteSuccess || shutdownLevel == NodeShutdownLevel.BuildCompleteFailure ) { if (Engine.debugMode) { Console.WriteLine("Node.Shutdown: NodeId " + nodeId + ": Clearing engine state and intern table ready for node re-use."); } if (localEngine != null) { localEngine.EndingEngineExecution (shutdownLevel == NodeShutdownLevel.BuildCompleteSuccess ? true : false, false); localEngine.ResetPerBuildDataStructures(); outProcLoggingService.ProcessPostedLoggingEvents(); buildInProgress = false; } // Clear the static table of interned strings BuildProperty.ClearInternTable(); } else { if (Engine.debugMode) { Console.WriteLine("Node.Shutdown: NodeId " + nodeId + ": Shutting down node due to error."); } // The thread starting the build loop will acquire this lock before starting the loop // in order to read the build requests. Acquiring it here ensures that build loop doesn't // get started between the check for null and setting of the flag lock (buildRequests) { if (localEngine == null) { nodeShutdown = true; } } if (localEngine != null) { // Indicate to the child engine that we need to exit localEngine.SetEngineAbortTo(true); // Wait for the exit event which will be raised once the child engine exits exitNodeEvent.WaitOne(); } } }