private void HandleChildTerminated(IActorRef child)
{
var status = RemoveChildAndGetStateChange(child);
//If this fails, we do nothing in case of terminating/restarting state,
//otherwise tell the supervisor etc. (in that second case, the match
//below will hit the empty default case, too)
if (_actor != null)
{
try
{
_actor.SupervisorStrategyInternal.HandleChildTerminated(this, child, GetChildren());
}
catch (Exception e)
{
HandleNonFatalOrInterruptedException(() =>
{
Publish(new Error(e, _self.Path.ToString(), _actor.GetType(), "HandleChildTerminated failed"));
HandleInvokeFailure(e);
});
}
}
// if the removal changed the state of the (terminating) children container,
// then we are continuing the previously suspended recreate/create/terminate action
var recreation = status as SuspendReason.Recreation;
if (recreation != null)
{
FinishRecreate(recreation.Cause,_actor);
}
else if (status is SuspendReason.Creation)
{
FinishCreate();
}
else if (status is SuspendReason.Termination)
{
FinishTerminate();
}
}