Example #1
0
 public void Unwatch(PID pid)
 {
     pid.SendSystemMessage(new Unwatch(Self));
     if (_watching == null)
     {
         _watching = new FastSet <PID>();
     }
     _watching.Remove(pid);
 }
Example #2
0
 public void Watch(PID pid)
 {
     pid.SendSystemMessage(new Watch(Self));
     if (_watching == null)
     {
         _watching = new FastSet <PID>();
     }
     _watching.Add(pid);
 }
        public PID SpawnNamed(Props props, string name)
        {
            var pid = props.Spawn($"{Self.Id}/{name}", Self);

            if (_children == null)
            {
                _children = new FastSet <PID>();
            }
            _children.Add(pid);

            return(pid);
        }
Example #4
0
        public Context(Func <IActor> producer, ISupervisorStrategy supervisorStrategy, Receive receiveMiddleware, Sender senderMiddleware, PID parent)
        {
            _producer           = producer;
            _supervisorStrategy = supervisorStrategy;
            _receiveMiddleware  = receiveMiddleware;
            _senderMiddleware   = senderMiddleware;
            Parent = parent;

            IncarnateActor();

            //fast path
            if (parent != null)
            {
                _watchers = new FastSet <PID>();
                _watchers.Add(parent);
            }
        }
Example #5
0
        public PID SpawnNamed(Props props, string name)
        {
            if (props.GuardianStrategy != null)
            {
                throw new ArgumentException("Props used to spawn child cannot have GuardianStrategy.");
            }

            var pid = props.Spawn($"{Self.Id}/{name}", Self);

            if (_children == null)
            {
                _children = new FastSet <PID>();
            }
            _children.Add(pid);

            return(pid);
        }
Example #6
0
 private void HandleWatch(Watch w)
 {
     if (_stopping)
     {
         w.Watcher.SendSystemMessage(new Terminated()
         {
             Who = Self
         });
     }
     else
     {
         if (_watchers == null)
         {
             _watchers = new FastSet <PID>();
         }
         _watchers.Add(w.Watcher);
     }
 }