public virtual void Send <T>(Actor actor, Action <T> consumer, ICompletes?completes, string representation) { var messageIndex = _sendIndex.IncrementAndGet(); var ringSendIndex = (int)(messageIndex % _mailboxSize); int retries = 0; while (ringSendIndex == (int)(_receiveIndex.Get() % _mailboxSize)) { if (++retries >= _mailboxSize) { if (_closed.Get()) { return; } retries = 0; } } _messages[ringSendIndex].Set(actor, consumer, completes, representation); while (_readyIndex.CompareAndSet(messageIndex - 1, messageIndex)) { } if (_notifyOnSend) { _dispatcher.Execute(this); } }
public LocalMessage(Actor actor, Action <TActor> consumer, ICompletes?completes, string representation) { this.actor = actor; this.consumer = consumer; this.representation = representation; this.completes = completes; }
public PooledCompletes( long id, ICompletes?clientCompletes, ICompletesEventually completesEventually) { Id = id; ClientCompletes = clientCompletes; CompletesEventually = completesEventually; }
public virtual void Send <T>(Actor actor, Action <T> consumer, ICompletes?completes, string representation) { var messageIndex = sendIndex.IncrementAndGet(); var ringSendIndex = (int)(messageIndex % mailboxSize); int retries = 0; while (ringSendIndex == (int)(receiveIndex.Get() % mailboxSize)) { if (++retries >= mailboxSize) { if (closed.Get()) { return; } retries = 0; } } messages[ringSendIndex].Set(actor, consumer, completes, representation); while (readyIndex.CompareAndSet(messageIndex - 1, messageIndex)) { } }
public ICompletesEventually ProvideCompletesFor(IAddress address, ICompletes?clientCompletes) => new PooledCompletes( completesEventuallyId.GetAndIncrement(), clientCompletes, CompletesEventuallyOf(address));
public ICompletesEventually ProvideCompletesFor(ICompletes?clientCompletes) => new PooledCompletes( completesEventuallyId.GetAndIncrement(), clientCompletes, CompletesEventually);
/// <summary> /// Answers a <see cref="ICompletesEventually"/> instance identified by <paramref name="address"/> that backs the <paramref name="clientCompletes"/>. /// This manages the <code>ICompletes</code> using the <code>ICompletesEventually</code> plugin <code>Actor</code> pool. /// </summary> /// <param name="address">The address of the ICompletesEventually actor to reuse.</param> /// <param name="clientCompletes">The <code>ICompletesEventually</code> allocated for eventual completion of <code>clientCompletes</code></param> /// <returns></returns> public ICompletesEventually CompletesFor(IAddress address, ICompletes?clientCompletes) => completesProviderKeeper.FindDefault().ProvideCompletesFor(address, clientCompletes);
/// <summary> /// Answers a new <see cref="ICompletesEventually"/> instance that backs the <paramref name="clientCompletes"/>. /// This manages the <c>ICompletes</c> using the <code>ICompletesEventually</code> plugin <c>Actor</c> pool. /// </summary> /// <param name="clientCompletes">The <code>ICompletesEventually</code> allocated for eventual completion of <c>clientCompletes</c></param> /// <returns></returns> public ICompletesEventually CompletesFor(ICompletes?clientCompletes) => completesProviderKeeper.FindDefault().ProvideCompletesFor(clientCompletes);
public void Send <T>(Actor actor, Action <T> consumer, ICompletes?completes, string representation) { throw new InvalidOperationException("Not a preallocated mailbox."); }
public void Send(Actor actor, Type protocol, LambdaExpression consumer, ICompletes?completes, string representation) => throw new NotSupportedException("TestMailbox does not support this operation.");
public void Send <T>(Actor actor, Action <T> consumer, ICompletes?completes, string representation) { throw new NotImplementedException(); }
public void Send(Actor actor, Type protocol, LambdaExpression consumer, ICompletes?completes, string representation) => throw new NotSupportedException("Not a preallocated mailbox.");
public void Send <T>(Actor actor, Action <T> consumer, ICompletes?completes, string representation) => throw new NotSupportedException("Not a preallocated mailbox.");