コード例 #1
0
 public static void GetResponses(Guid id, IParticipantReference <TRequest, TResponse> func, Envelope <TRequest> request, IGatherReceiver <TResponse> scatter, string name)
 {
     try
     {
         var response = func.Invoke(request);
         scatter.AddResponse(id, ScatterResponse <TResponse> .Success(id, name, response));
     }
     catch (Exception e)
     {
         scatter.AddResponse(id, ScatterResponse <TResponse> .Error(id, name, e));
     }
 }
コード例 #2
0
 public void Execute()
 {
     try
     {
         var response = _func.Invoke(_request);
         _scatter.AddResponse(ParticipantId, ScatterResponse <TResponse> .Success(ParticipantId, _name, response));
     }
     catch (Exception e)
     {
         _scatter.AddResponse(ParticipantId, ScatterResponse <TResponse> .Error(ParticipantId, _name, e));
     }
 }
コード例 #3
0
ファイル: Scatter.cs プロジェクト: Whiteknight/Acquaintance
        public void AddResponse(Guid participantId, ScatterResponse <TResponse> response)
        {
            if (!_respondents.TryUpdate(participantId, true, false))
            {
                return;
            }

            Interlocked.Increment(ref _completedParticipants);
            _responses.Add(response);
            Interlocked.Decrement(ref _expectCount);
            Interlocked.MemoryBarrier();
        }