Akka.Actor.ActorCell.FaultRecreate C# (CSharp) Метод

FaultRecreate() приватный Метод

Re-create the actor in response to a failure.
private FaultRecreate ( Exception cause ) : void
cause System.Exception
Результат void
        private void FaultRecreate(Exception cause)
        {
            if (_actor == null)
            {
                _systemImpl.EventStream.Publish(new Error(null, _self.Path.ToString(), GetType(), "Changing Recreate into Create after " + cause));
                FaultCreate();
                return;
            }
            if (IsNormal)
            {
                var failedActor = _actor;

                if (System.Settings.DebugLifecycle)
                    Publish(new Debug(_self.Path.ToString(), failedActor.GetType(), "Restarting"));

                if (failedActor != null)
                {
                    var optionalMessage = CurrentMessage;

                    try
                    {
                        // if the actor fails in preRestart, we can do nothing but log it: it’s best-effort
                        failedActor.AroundPreRestart(cause, optionalMessage);

                        // run actor pre-incarnation plugin pipeline
                        var pipeline = _systemImpl.ActorPipelineResolver.ResolvePipeline(failedActor.GetType());
                        pipeline.BeforeActorIncarnated(failedActor, this);
                    }
                    catch (Exception e)
                    {
                        HandleNonFatalOrInterruptedException(() =>
                        {
                            var ex = new PreRestartException(_self, e, cause, optionalMessage);
                            Publish(new Error(ex, _self.Path.ToString(), failedActor.GetType(), e.Message));
                        });
                    }
                    finally
                    {
                        ClearActor(_actor);
                    }
                }

                global::System.Diagnostics.Debug.Assert(Mailbox.IsSuspended, "Mailbox must be suspended during restart, status=" + Mailbox.Status);
                if (!SetChildrenTerminationReason(new SuspendReason.Recreation(cause)))
                {
                    FinishRecreate(cause, failedActor);
                }
            }
            else
            {
                // need to keep that suspend counter balanced
                FaultResume(null);
            }
        }