public void AddMailbox(string path, Func<UntypedActor> createFunc, int maxCapacity) { // TODO: Allow to define default maxCapavity in declarative way Mailbox mailbox = new Mailbox(this, path, createFunc, maxCapacity); lock (this) { if (this.isStopping) { throw new InvalidOperationException("Cannot add new mailbox to system which is being stopped"); } } if (!this.mailboxes.TryAdd(path, mailbox)) { throw new ArgumentException("There is already actor registered at path: " + path); } this.queue.Enqueue(mailbox); }
public void AddMailbox(string path, Func <UntypedActor> createFunc, int maxCapacity) { // TODO: Allow to define default maxCapavity in declarative way Mailbox mailbox = new Mailbox(this, path, createFunc, maxCapacity); lock (this) { if (this.isStopping) { throw new InvalidOperationException("Cannot add new mailbox to system which is being stopped"); } } if (!this.mailboxes.TryAdd(path, mailbox)) { throw new ArgumentException("There is already actor registered at path: " + path); } this.queue.Enqueue(mailbox); }
private void RunThread() { int sleepInterval = 100; // TODO: Make this configurable? while (true) { Console.Write("."); Mailbox mailbox = null; if (this.queue.TryDequeue(out mailbox)) { if (mailbox.ProcessOutcomes()) { mailbox.ProcessMessages(); } } Thread.Sleep(sleepInterval); if (mailbox != null) { this.queue.Enqueue(mailbox); } } }
internal override bool Process(Mailbox mailbox) { return(this.task.IsCompleted); }
internal override bool Process(Mailbox mailbox) { return(mailbox.System.TrySendMessage(mailbox.Path, dstPath, message)); }
internal abstract bool Process(Mailbox mailbox);