コード例 #1
0
ファイル: OutgoingAsync.cs プロジェクト: wandec/ice
        public void RetryException()
        {
            try
            {
                //
                // It's important to let the retry queue do the retry. This is
                // called from the connect request handler and the retry might
                // require could end up waiting for the flush of the
                // connection to be done.
                //

                // Clear request handler and always retry.
                if (!Proxy.IceReference.IsFixed)
                {
                    Proxy.IceReference.UpdateRequestHandler(Handler, null);
                }
                Communicator.AddRetryTask(this, 0);
            }
            catch (Exception ex)
            {
                if (Exception(ex))
                {
                    Task.Run(InvokeException);
                }
            }
        }
コード例 #2
0
ファイル: OutgoingAsync.cs プロジェクト: wandec/ice
        public override bool Exception(Exception exc)
        {
            if (ChildObserver != null)
            {
                ChildObserver.Failed(exc.GetType().FullName ?? "System.Exception");
                ChildObserver.Detach();
                ChildObserver = null;
            }

            CachedConnection = null;

            //
            // NOTE: at this point, synchronization isn't needed, no other threads should be
            // calling on the callback.
            //
            try
            {
                //
                // It's important to let the retry queue do the retry even if
                // the retry interval is 0. This method can be called with the
                // connection locked so we can't just retry here.
                //
                Communicator.AddRetryTask(this, Proxy.IceHandleException(exc, Handler, IsIdempotent, _sent, ref _cnt));
                return(false);
            }
            catch (Exception ex)
            {
                return(ExceptionImpl(ex)); // No retries, we're done
            }
        }
コード例 #3
0
ファイル: OutgoingAsync.cs プロジェクト: wandec/ice
        protected void InvokeImpl(bool userThread)
        {
            try
            {
                if (userThread)
                {
                    int invocationTimeout = Proxy.IceReference.InvocationTimeout;
                    if (invocationTimeout > 0)
                    {
                        Communicator.Timer().Schedule(this, invocationTimeout);
                    }
                }
                else if (Observer != null)
                {
                    Observer.Retried();
                }

                while (true)
                {
                    try
                    {
                        _sent   = false;
                        Handler = Proxy.IceReference.GetRequestHandler();
                        Handler.SendAsyncRequest(this);
                        return; // We're done!
                    }
                    catch (RetryException)
                    {
                        // Clear request handler and always retry.
                        if (!Proxy.IceReference.IsFixed)
                        {
                            Proxy.IceReference.UpdateRequestHandler(Handler, null);
                        }
                    }
                    catch (Exception ex)
                    {
                        if (ChildObserver != null)
                        {
                            ChildObserver.Failed(ex.GetType().FullName ?? "System.Exception");
                            ChildObserver.Detach();
                            ChildObserver = null;
                        }
                        int interval = Proxy.IceHandleException(ex, Handler, IsIdempotent, _sent, ref _cnt);
                        if (interval > 0)
                        {
                            Communicator.AddRetryTask(this, interval);
                            return;
                        }
                        else if (Observer != null)
                        {
                            Observer.Retried();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //
                // If called from the user thread we re-throw, the exception
                // will be caught by the caller and abort() will be called.
                //
                if (userThread)
                {
                    throw;
                }
                else if (ExceptionImpl(ex)) // No retries, we're done
                {
                    Task.Run(InvokeException);
                }
            }
        }