protected void ClearActor(ActorBase actor)
{
if (actor != null)
{
var disposable = actor as IDisposable;
if (disposable != null)
{
try
{
disposable.Dispose();
}
catch (Exception e)
{
if (_systemImpl.Log != null)
{
_systemImpl.Log.Error(e, "An error occurred while disposing {0} actor. Reason: {1}",
actor.GetType(), e.Message);
}
}
}
ReleaseActor(actor);
actor.Clear(_systemImpl.DeadLetters);
}
_actorHasBeenCleared = true;
CurrentMessage = null;
//TODO: semantics here? should all "_state" be cleared? or just behavior?
_state = _state.ClearBehaviorStack();
}