// Failure ------------------------------------------------------------------------------------- protected virtual bool EscalateError(Exception exception, IEnumerable <ActorRef> childrenNotToSuspend = null) //virtual so we can override it to be able to write tests { if (!IsFailed) { try { SuspendThisOnly(); var childrenToSkip = childrenNotToSuspend == null ? new HashSet <ActorRef>() : new HashSet <ActorRef>(childrenNotToSuspend); var currentMessage = CurrentMessage; var wasHandled = (currentMessage != null && PatternMatcher.Match <ActorFailed>(currentMessage.Message, m => { SetFailedPerpatrator(m.Child); childrenToSkip.Add(m.Child); })) || PatternMatcher.MatchAll(() => SetFailedPerpatrator(this)); SuspendChildren(childrenToSkip); _supervisor.SendSystemMessage(new ActorFailed(this, exception, InstanceId), this); } catch (Exception e) { Publish(new ErrorLogEvent(_path.ToString(), SafeGetTypeForLogging(), "Emergency stop: exception in failure handling for " + exception, e)); try { Children.GetChildrenRefs().ForEach(c => c.Stop()); } finally { //TODO: FinishTerminate() } } } return(true); }
public override void SendSystemMessage(SystemMessage message, ActorRef sender) { var ignored = PatternMatcher.Match <SuperviseActor>(message, _ => { }) || PatternMatcher.MatchAll(message, _ => { //TODO: Log "Recevied unexpected system message of type {0}: {1}", message.GetType(), message }); }