示例#1
0
文件: PluginI.cs 项目: manics/ice
        internal void Invoke(ILocatorPrx l)
        {
            if (_locatorPrx == null || !_locatorPrx.Equals(l))
            {
                _locatorPrx = l;
                var requestFrame = new OutgoingRequestFrame(l, _operation, _idempotent, _context, _payload);

                l.InvokeAsync(requestFrame).ContinueWith(
                    task =>
                {
                    try
                    {
                        SetResult(task.Result);
                    }
                    catch (AggregateException ae)
                    {
                        Exception(ae.InnerException);
                    }
                },
                    TaskScheduler.Current);
            }
            else
            {
                Debug.Assert(_exception != null);
                throw _exception;
            }
        }
示例#2
0
文件: PluginI.cs 项目: yzun/ice
 Invoke(ILocatorPrx l)
 {
     if (_locatorPrx == null || !_locatorPrx.Equals(l))
     {
         _locatorPrx = l;
         l.InvokeAsync(_operation, _mode, _inParams, _context).ContinueWith(
             (task) =>
         {
             try
             {
                 SetResult(task.Result);
             }
             catch (AggregateException ae)
             {
                 Exception(ae.InnerException);
             }
         },
             TaskScheduler.Current);
     }
     else
     {
         Debug.Assert(_exception != null);
         throw _exception;
     }
 }
示例#3
0
文件: Plugin.cs 项目: yuweiApp/ice
 public async ValueTask<OutgoingResponseFrame> DispatchAsync(
     IncomingRequestFrame incomingRequest,
     Current current)
 {
     ILocatorPrx? locator = null;
     Exception? exception = null;
     while (true)
     {
         // Get the locator to send the request to (this will return the void locator if no locator is found)
         ILocatorPrx newLocator = await GetLocatorAsync().ConfigureAwait(false);
         if (locator != newLocator)
         {
             var outgoingRequest = new OutgoingRequestFrame(
                 newLocator, current.Operation, current.IsIdempotent, current.Context, incomingRequest.Payload);
             try
             {
                 IncomingResponseFrame incomingResponse =
                     await newLocator.InvokeAsync(outgoingRequest).ConfigureAwait(false);
                 return new OutgoingResponseFrame(current.Protocol, current.Encoding, incomingResponse.Payload);
             }
             catch (DispatchException)
             {
                 throw;
             }
             catch (NoEndpointException)
             {
                 throw new ObjectNotExistException(current);
             }
             catch (ObjectAdapterDeactivatedException)
             {
                 throw new ObjectNotExistException(current);
             }
             catch (CommunicatorDestroyedException)
             {
                 throw new ObjectNotExistException(current);
             }
             catch (Exception ex)
             {
                 lock (_mutex)
                 {
                     locator = newLocator;
                     // If the current locator is equal to the one we use to send the request,
                     // clear it and retry, this will trigger the lookup of a new locator.
                     if (_locator == newLocator)
                     {
                         _locator = null;
                     }
                 }
                 exception = ex;
             }
         }
         else
         {
             // We got the same locator after a previous failure, throw the saved exception now.
             Debug.Assert(exception != null);
             throw exception;
         }
     }
 }
示例#4
0
        internal async Task Invoke(ILocatorPrx l)
        {
            if (_locatorPrx == null || !_locatorPrx.Equals(l))
            {
                _locatorPrx = l;
                var requestFrame = new OutgoingRequestFrame(l, _current.Operation, _current.IsIdempotent,
                    _current.Context, _payload);

                try
                {
                    SetResult(await l.InvokeAsync(requestFrame).ConfigureAwait(false));
                }
                catch (Exception ex)
                {
                    Exception(ex);
                }
            }
            else
            {
                Debug.Assert(_exception != null);
                throw _exception;
            }
        }