private void HandleWatch(Watch w) { if (_state >= ContextState.Stopping) { w.Watcher.SendSystemMessage(Terminated.From(Self)); } else { EnsureExtras().Watch(w.Watcher); } }
//Last and final termination step private async Task FinalizeStopAsync() { ProcessRegistry.Instance.Remove(Self); //This is intentional await InvokeUserMessageAsync(Stopped.Instance); DisposeActorIfDisposable(); //Notify watchers _extras?.Watchers.SendSystemNessage(Terminated.From(Self)); //Notify parent Parent?.SendSystemMessage(Terminated.From(Self)); _state = ContextState.Stopped; }