private void HandleSubMachineFaulted(object sender, FaultedEventArgs e) { var faultedMachine = sender as TransportOperationMachine; lock (_subMachineLock) { if (_isComplete) { return; } if (IsStopped) { // If the move was cancelled, don't retry and don't give a fault. TeardownForInterruption(); } else if (NumberOfRetries > 0) { var message = string.Format(CultureInfo.InvariantCulture, "Tray '{0}' failed{1} due to fault: {2}", faultedMachine.Name, faultedMachine.Station == null ? string.Empty : " at " + faultedMachine.Station.Name, e.Cause == null ? "unknown cause" : e.Cause.Message); LogService.Log(LogType.System, LogMessageType.Error, GetType().Name, message, e.Cause); Retry(faultedMachine); } else { RaiseTransportationException(faultedMachine, "fault", e.Cause); TeardownForFault(e); } } }
private void OnFaulted(FaultedEventArgs e) { var handler = Faulted; if (handler != null) { handler(this, e); } }
private void TeardownForFault(FaultedEventArgs e) { _isComplete = true; CompletionCause = CompletionCause.Faulted; Teardown(); // Signal that it faulted. This MUST happen between Teardown and Dispose. OnFaulted(e); Dispose(); }
protected void HandleNodeFaulted(object sender, FaultedEventArgs args) { if (HaltOnFault) { // Don't raise the event here, just set the completion cause. lock (_executionLock) { Fault = args.Cause; CompletionCause = CompletionCause.Faulted; } } }
protected virtual void HandleMachineFaulted(object sender, FaultedEventArgs args) { // unsubscribe from machine SubscribeToMachine(Machine, false); IsFaulted = true; StopTiming(); OnExecutableFaulted(args.Cause); OnSubmachineDone(); Dispose(); }
protected virtual void HandleExecutableFaulted(object sender, FaultedEventArgs args) { var exe = sender as IExecutable; if (exe == null) { return; } LogService.Log(LogType.System, LogMessageType.Error, GetType().Name, string.Format(CultureInfo.InvariantCulture, "'{0}' quit with {1}: {2}", exe.Name, args.Cause == null ? "unknown exception." : args.Cause.GetType().Name, args.Cause == null ? string.Empty : args.Cause.Message), args.Cause); CleanupAfterExecutable(exe); }
private void OnFaulted(FaultedEventArgs args) { if (Faulted != null) { try { LogService.Log(LogType.System, LogMessageType.Debug, GetType().Name, string.Format(CultureInfo.InvariantCulture, "{0} raising Faulted event.", Name)); Faulted(this, args); } catch (Exception e) { LogService.Log(LogType.System, LogMessageType.Error, GetType().Name, e.GetType().Name + " while raising Faulted event. (" + Name + ")", e); } } }
private void OnFaulted(FaultedEventArgs args) { try { var message = string.Format(CultureInfo.InvariantCulture, "Node '{0}' faulted: {1}", Name, args.Cause == null ? "cause unknown" : args.Cause.Message); LogService.Log(LogType, LogMessageType.Error, ContainerName, message, args.Cause); if (Faulted != null) { Faulted(this, args); } } catch (Exception ex) { var message = string.Format(CultureInfo.InvariantCulture, "Node '{0}' encountered a {1} while raising the Faulted event", Name, ex.GetType().Name); LogService.Log(LogType, LogMessageType.Error, ContainerName, message, ex); } }
private void HandleBehaviorFaulted(object sender, FaultedEventArgs eventArgs) { SubscribeToBehavior(false, sender as IExecutable); OnFaulted(eventArgs); }
private void HandleExecuteInitialBehaviorFaulted(object sender, FaultedEventArgs args) { // Must do teardown directly here. The machine execution is not working, so cannot rely on the // ExitNode to call this. This will release any locks too. QuitInternal(true, args.Cause); }