private void EndProcessClassificationObjects() { try { if (ProcessingFinished != null) { ProcessingFinished(this, null); } Trace.TraceInformation("Processing Classification Objects finished. (took: {0})", Monitor.ProcessingElapsed); CurrentRuleManager.OnRulesCleanupEvent(); if (OutputStarting != null) { OutputStarting(this, null); } Trace.TraceInformation("Creating output started."); // flush output to all the registered output writers // this is done in synchronous manner to support simple architecture for output writers // output writers can be asynchronous but it has to be transparent to the engine, i.e. they would have to // block on IOutputWriter.Finish to wait for asynchronous operations to finalize CurrentRuleManager.OutputWriter.FlushOutput(CurrentRuleManager.OutputFromAllRules); CurrentRuleManager.OutputWriter.FinishOutputWriters(); if (OutputFinished != null) { OutputFinished(this, null); } Trace.TraceInformation("Creating output finished. (took: {0})", Monitor.OutputElapsed); } catch (OutOfMemoryException e) { Trace.TraceError("Ran out of memory writing output logs. Further processing will be aborted..."); Monitor.LogException(e); AbortProcessing(); } finally { AllOutputFinished.Set(); CoProcessingDone.Set(); } }
private void AbortProcessing() { CoProcessingDone.Set(); AllOutputFinished.Set(); }
/// <summary> /// Waits for all processing threads started by an instance of Engine to complete. /// <list type="ol"><listheader>This includes:</listheader> /// <item>Waiting for all rules to finish processing</item> /// <item>Waiting for all output writers to complete output and flush it to backing store</item> /// </list> /// </summary> public override void WaitForJobFinish() { CoProcessingDone.WaitOne(); // block this thread until the engine is done AllOutputFinished.WaitOne(); //wait for output to finish }