コード例 #1
0
    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);
        }
    }
コード例 #2
0
 public LocalMessage(Actor actor, Action <TActor> consumer, ICompletes?completes, string representation)
 {
     this.actor          = actor;
     this.consumer       = consumer;
     this.representation = representation;
     this.completes      = completes;
 }
コード例 #3
0
 public PooledCompletes(
     long id,
     ICompletes?clientCompletes,
     ICompletesEventually completesEventually)
 {
     Id = id;
     ClientCompletes     = clientCompletes;
     CompletesEventually = completesEventually;
 }
コード例 #4
0
        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))
            {
            }
        }
コード例 #5
0
 public ICompletesEventually ProvideCompletesFor(IAddress address, ICompletes?clientCompletes)
 => new PooledCompletes(
     completesEventuallyId.GetAndIncrement(),
     clientCompletes,
     CompletesEventuallyOf(address));
コード例 #6
0
 public ICompletesEventually ProvideCompletesFor(ICompletes?clientCompletes)
 => new PooledCompletes(
     completesEventuallyId.GetAndIncrement(),
     clientCompletes,
     CompletesEventually);
コード例 #7
0
ファイル: World.cs プロジェクト: mihaj/vlingo-net-actors
 /// <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);
コード例 #8
0
ファイル: World.cs プロジェクト: mihaj/vlingo-net-actors
 /// <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);
コード例 #9
0
 public void Send <T>(Actor actor, Action <T> consumer, ICompletes?completes, string representation)
 {
     throw new InvalidOperationException("Not a preallocated mailbox.");
 }
コード例 #10
0
 public void Send(Actor actor, Type protocol, LambdaExpression consumer, ICompletes?completes, string representation) =>
 throw new NotSupportedException("TestMailbox does not support this operation.");
コード例 #11
0
 public void Send <T>(Actor actor, Action <T> consumer, ICompletes?completes, string representation)
 {
     throw new NotImplementedException();
 }
コード例 #12
0
 public void Send(Actor actor, Type protocol, LambdaExpression consumer, ICompletes?completes, string representation) =>
 throw new NotSupportedException("Not a preallocated mailbox.");
コード例 #13
0
 public void Send <T>(Actor actor, Action <T> consumer, ICompletes?completes, string representation) =>
 throw new NotSupportedException("Not a preallocated mailbox.");