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

AddWatcher() защищенный Метод

protected AddWatcher ( IActorRef watchee, IActorRef watcher ) : void
watchee IActorRef
watcher IActorRef
Результат void
        protected void AddWatcher(IActorRef watchee, IActorRef watcher)
        {
            var watcheeSelf = watchee.Equals(Self);
            var watcherSelf = watcher.Equals(Self);

            if (watcheeSelf && !watcherSelf)
            {
                if (!_state.ContainsWatchedBy(watcher)) MaintainAddressTerminatedSubscription(() =>
                {
                    _state = _state.AddWatchedBy(watcher);

                    if (System.Settings.DebugLifecycle) Publish(new Debug(Self.Path.ToString(), Actor.GetType(), string.Format("now watched by {0}", watcher)));
                }, watcher);
            }
            else if (!watcheeSelf && watcherSelf)
            {
                Watch(watchee);
            }
            else
            {
                Publish(new Warning(Self.Path.ToString(), Actor.GetType(), string.Format("BUG: illegal Watch({0},{1} for {2}", watchee, watcher, Self)));
            }
        }