/// <summary> /// Handles the specified child. /// </summary> /// <param name="child">The child.</param> /// <param name="x">The x.</param> /// <returns>Directive.</returns> public override Directive Handle(ActorRef child, Exception x) { Failures failures; actorFailures.TryGetValue(child, out failures); //create if missing if (failures == null) { failures = new Failures(); actorFailures.Add(child, failures); } //add entry failures.Entries.Add(new Failure { Exception = x, Timestamp = DateTime.Now, }); //remove expired failures.Entries.RemoveAll(f => f.Timestamp < DateTime.Now - WithinTimeRange); //calc count of active int count = failures.Entries.Count(); if (count > MaxNumberOfRetries) { return Directive.Stop; } Directive whatToDo = Decider(x); return whatToDo; }