private void Create(Exception failure)
{
if (failure != null)
throw failure;
try
{
var created = NewActor();
_actor = created;
UseThreadContext(() => created.AroundPreStart());
CheckReceiveTimeout();
if (System.Settings.DebugLifecycle)
Publish(new Debug(Self.Path.ToString(), created.GetType(), "Started (" + created + ")"));
}
catch (Exception e)
{
if (_actor != null)
{
ClearActor(_actor);
_actor = null; // ensure that we know that we failed during creation
}
throw new ActorInitializationException(_self, "Exception during creation", e);
}
}