private void Handle(ClusterActorDiscoveryMessage.ActorUp m)
        {
            _log.Info($"Container.ActorUp (Actor={m.Actor.Path})");

            if (_stopping)
            {
                _log.Info($"Ignore ActorUp while stopping. (Actor={m.Actor.Path})");
                return;
            }

            if (_containerMap.ContainsKey(m.Actor))
            {
                _log.Error($"I already have that container. (Actor={m.Actor.Path})");
                return;
            }

            _containerMap.Add(m.Actor, new Container
            {
                LinkTime = DateTime.UtcNow,
                ActorMap = new Dictionary <TKey, IActorRef>()
            });
            RebuildContainerWorkQueue();

            if (_underTestEnvironment)
            {
                Context.Watch(m.Actor);
            }
        }
Esempio n. 2
0
        private void Handle(ClusterActorDiscoveryMessage.ActorUp m)
        {
            _log.Info($"Table.ActorUp (Actor={m.Actor.Path})");

            if (_table != null)
            {
                _log.Error($"But I already have table. (Actor={_table.Path})");
                return;
            }

            _table = m.Actor;
        }
        private void Handle(ClusterActorDiscoveryMessage.ActorUp m)
        {
            _log.Info($"Container.ActorUp (Actor={m.Actor.Path})");

            if (_stopping)
            {
                _log.Info($"Ignore ActorUp while stopping. (Actor={m.Actor.Path})");
                return;
            }

            if (_containerMap.ContainsKey(m.Actor))
            {
                _log.Error($"I already have that container. (Actor={m.Actor.Path})");
                return;
            }

            var container = new Container
            {
                LinkTime = DateTime.UtcNow,
                ActorMap = new Dictionary <TKey, IActorRef>()
            };

            _containerMap.Add(m.Actor, container);
            RebuildContainerWorkQueue();

            if (_queuedCreatingExists)
            {
                foreach (var item in _creatingMap)
                {
                    if (item.Value.WorkingContainer == null)
                    {
                        item.Value.WorkingContainer = m.Actor;
                        container.ActorMap.Add(item.Key, null);
                        m.Actor.Tell(new DistributedActorTableMessage <TKey> .Internal.Create(item.Key, item.Value.Arguments));
                    }
                }
                _queuedCreatingExists = false;
            }

            if (_underTestEnvironment)
            {
                Context.Watch(m.Actor);
            }
        }