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); }
private void SendFirstIn(Stowage stowage) { var maybeMessage = stowage.Head; if (maybeMessage != null) { Environment.Mailbox.Send(maybeMessage); } }
internal void Restow(Stowage other) { var message = Head; while (message != null) { other.Stow(message); message = Head; } }
internal void Stop() { if (stopped.CompareAndSet(false, true)) { StopChildren(); Suspended.Reset(); Stowage.Reset(); Mailbox.Close(); } }
internal bool SendFirstIn(Stowage stowage) { var maybeMessage = stowage.Head; if (maybeMessage != null) { Environment.Mailbox.Send(maybeMessage); return(true); } return(false); }