コード例 #1
0
        protected internal Environment(
            Stage stage,
            IAddress address,
            Definition definition,
            Actor parent,
            IMailbox mailbox,
            ISupervisor maybeSupervisor,
            ILogger logger)
        {
            Stage      = stage ?? throw new ArgumentNullException(nameof(stage));
            Address    = address ?? throw new ArgumentNullException(nameof(address));
            Definition = definition ?? throw new ArgumentNullException(nameof(definition));
            if (address.Id != World.PrivateRootId)
            {
                Parent = parent ?? throw new ArgumentNullException(nameof(parent));
            }
            else
            {
                Parent = parent;
            }
            Mailbox          = mailbox ?? throw new ArgumentNullException(nameof(mailbox));
            MaybeSupervisor  = maybeSupervisor;
            FailureMark      = new FailureMark();
            Logger           = logger;
            Children         = new List <Actor>(0);
            ProxyCache       = new Dictionary <Type, object>();
            Stowage          = new Stowage();
            stowageOverrides = null;
            Suspended        = new Stowage();

            secured = new AtomicBoolean(false);
            stopped = new AtomicBoolean(false);
        }
コード例 #2
0
        private void SendFirstIn(Stowage stowage)
        {
            var maybeMessage = stowage.Head;

            if (maybeMessage != null)
            {
                Environment.Mailbox.Send(maybeMessage);
            }
        }
コード例 #3
0
        internal void Restow(Stowage other)
        {
            var message = Head;

            while (message != null)
            {
                other.Stow(message);
                message = Head;
            }
        }
コード例 #4
0
 internal void Stop()
 {
     if (stopped.CompareAndSet(false, true))
     {
         StopChildren();
         Suspended.Reset();
         Stowage.Reset();
         Mailbox.Close();
     }
 }
コード例 #5
0
        internal bool SendFirstIn(Stowage stowage)
        {
            var maybeMessage = stowage.Head;

            if (maybeMessage != null)
            {
                Environment.Mailbox.Send(maybeMessage);
                return(true);
            }
            return(false);
        }