示例#1
0
        public void AsyncRequestCanceled(OutgoingAsyncBase outAsync, Ice.LocalException ex)
        {
            lock (this)
            {
                if (_exception != null)
                {
                    return; // The request has been notified of a failure already.
                }

                if (!Initialized())
                {
                    LinkedListNode <ProxyOutgoingAsyncBase> p = _requests.First;
                    while (p != null)
                    {
                        if (p.Value == outAsync)
                        {
                            _requests.Remove(p);
                            if (outAsync.Exception(ex))
                            {
                                outAsync.InvokeExceptionAsync();
                            }
                            return;
                        }
                        p = p.Next;
                    }
                    Debug.Assert(false); // The request has to be queued if it timed out and we're not initialized yet.
                }
            }
            Debug.Assert(_connection != null);
            _connection.AsyncRequestCanceled(outAsync, ex);
        }
示例#2
0
        protected void Cancel(Ice.LocalException ex)
        {
            ICancellationHandler handler;

            {
                lock (this)
                {
                    if (_cancellationHandler == null)
                    {
                        _cancellationException = ex;
                        return;
                    }
                    handler = _cancellationHandler;
                }
            }
            handler.AsyncRequestCanceled(this, ex);
        }
示例#3
0
        public void SetException(Ice.LocalException ex)
        {
            lock (this)
            {
                Debug.Assert(!_flushing && !_initialized && _exception == null);
                _exception = ex;
                _flushing  = true; // Ensures request handler is removed before processing new requests.
            }

            //
            // NOTE: remove the request handler *before* notifying the requests that the connection
            // failed. It's important to ensure that future invocations will obtain a new connect
            // request handler once invocations are notified.
            //
            try
            {
                _reference.GetCommunicator().RemoveRequestHandler(_reference, this);
            }
            catch (Ice.CommunicatorDestroyedException)
            {
                // Ignore
            }

            foreach (ProxyOutgoingAsyncBase outAsync in _requests)
            {
                if (outAsync.Exception(_exception))
                {
                    outAsync.InvokeExceptionAsync();
                }
            }
            _requests.Clear();

            lock (this)
            {
                _flushing = false;
                _proxies.Clear();
                _proxy = null; // Break cyclic reference count.
                Monitor.PulseAll(this);
            }
        }
示例#4
0
 public void exception(Ice.LocalException exception)
 {
     _callback.exception(exception);
 }
示例#5
0
 public int closing(bool initiator, Ice.LocalException ex)
 {
     return(_transceiver.closing(initiator, ex));
 }
示例#6
0
        public void invokeException(int requestId, LocalException ex, int invokeNum, bool amd)
        {
            //
            // Fatal exception while invoking a request. Since sendResponse/sendNoResponse isn't
            // called in case of a fatal exception we decrement _dispatchCount here.
            //

            lock(this)
            {
                setState(StateClosed, ex);

                if(invokeNum > 0)
                {
                    Debug.Assert(_dispatchCount >= invokeNum);
                    _dispatchCount -= invokeNum;
                    if(_dispatchCount == 0)
                    {
                        if(_state == StateFinished)
                        {
                            reap();
                        }
                        System.Threading.Monitor.PulseAll(this);
                    }
                }
            }
        }
示例#7
0
 internal void completed(LocalException ex)
 {
     if(outAsync != null)
     {
         Ice.AsyncCallback cb = outAsync.completed(ex);
         if(cb != null)
         {
             outAsync.invokeCompleted(cb);
         }
     }
 }
示例#8
0
        private void setState(int state, LocalException ex)
        {
            //
            // If setState() is called with an exception, then only closed
            // and closing states are permissible.
            //
            Debug.Assert(state >= StateClosing);

            if(_state == state) // Don't switch twice.
            {
                return;
            }

            if(_exception == null)
            {
                //
                // If we are in closed state, an exception must be set.
                //
                Debug.Assert(_state != StateClosed);

                _exception = ex;

                //
                // We don't warn if we are not validated.
                //
                if(_warn && _validated)
                {
                    //
                    // Don't warn about certain expected exceptions.
                    //
                    if(!(_exception is CloseConnectionException ||
                         _exception is ForcedCloseConnectionException ||
                         _exception is ConnectionTimeoutException ||
                         _exception is CommunicatorDestroyedException ||
                         _exception is ObjectAdapterDeactivatedException ||
                         (_exception is ConnectionLostException && _state >= StateClosing)))
                    {
                        warning("connection exception", _exception);
                    }
                }
            }

            //
            // We must set the new state before we notify requests of any
            // exceptions. Otherwise new requests may retry on a
            // connection that is not yet marked as closed or closing.
            //
            setState(state);
        }
示例#9
0
 public void exception(LocalException ex)
 {
     lock(this)
     {
         setState(StateClosed, ex);
     }
 }
示例#10
0
 internal void deadRemoteLogger(Ice.RemoteLoggerPrx remoteLogger, Ice.Logger logger, Ice.LocalException ex,
                                string operation)
 {
     //
     // No need to convert remoteLogger as we only use its identity
     //
     if (removeRemoteLogger(remoteLogger))
     {
         if (_traceLevel > 0)
         {
             logger.trace(_traceCategory, "detached `" + remoteLogger.ToString() + "' because "
                          + operation + " raised:\n" + ex.ToString());
         }
     }
 }
示例#11
0
文件: Proxy.cs 项目: bholl/zeroc-ice
        public int handleException__(ObjectDel_ @delegate, LocalException ex, bool sleep, ref int cnt)
        {
            //
            // Only _delegate needs to be mutex protected here.
            //
            lock(this)
            {
                if(@delegate == _delegate)
                {
                    _delegate = null;
                }
            }

            if(cnt == -1) // Don't retry if the retry count is -1.
            {
                throw ex;
            }

            try
            {
                return _reference.getInstance().proxyFactory().checkRetryAfterException(ex, _reference, sleep, ref cnt);
            }
            catch(CommunicatorDestroyedException)
            {
                //
                // The communicator is already destroyed, so we cannot
                // retry.
                //
                throw ex;
            }
        }
示例#12
0
 internal void finished(LocalException ex)
 {
     if(@out != null)
     {
         @out.finished(ex, isSent);
     }
     else if(outAsync != null)
     {
         outAsync.finished__(ex, isSent);
     }
 }
示例#13
0
        public void invokeException(LocalException ex, int invokeNum)
        {
            //
            // Fatal exception while invoking a request. Since sendResponse/sendNoResponse isn't
            // called in case of a fatal exception we decrement _dispatchCount here.
            //

            _m.Lock();
            try
            {
                setState(StateClosed, ex);

                if(invokeNum > 0)
                {
                    Debug.Assert(_dispatchCount > 0);
                    _dispatchCount -= invokeNum;
                    Debug.Assert(_dispatchCount >= 0);
                    if(_dispatchCount == 0)
                    {
                        if(_state == StateFinished)
                        {
                            _reaper.add(this, _observer);
                        }
                        _m.NotifyAll();
                    }
                }
            }
            finally
            {
                _m.Unlock();
            }
        }
示例#14
0
 public void exception(LocalException ex)
 {
     _m.Lock();
     try
     {
         setState(StateClosed, ex);
     }
     finally
     {
         _m.Unlock();
     }
 }
示例#15
0
 internal void completed(LocalException ex)
 {
     if(outAsync != null)
     {
         if(outAsync.exception(ex))
         {
             outAsync.invokeException();
         }
     }
     stream = null;
 }
示例#16
0
        public int handleException__(ObjectDel_ @delegate, LocalException ex, bool sleep, ref int cnt, 
                                     InvocationObserver obsv)
        {
            //
            // Only _delegate needs to be mutex protected here.
            //
            lock(this)
            {
                if(@delegate == _delegate)
                {
                    _delegate = null;
                }
            }

            try
            {
                if(cnt == -1) // Don't retry if the retry count is -1.
                {
                    throw ex;
                }
                
                int interval;
                try
                {
                    interval = _reference.getInstance().proxyFactory().checkRetryAfterException(ex, _reference, sleep,
                                                                                                ref cnt);
                }
                catch(CommunicatorDestroyedException)
                {
                    //
                    // The communicator is already destroyed, so we cannot
                    // retry.
                    //
                    throw ex;
                }
                if(obsv != null)
                {
                    obsv.retried();
                }
                return interval;
            }
            catch(Ice.LocalException e)
            {
                if(obsv != null)
                {
                    obsv.failed(e.ice_name());
                }
                throw;
            }
        }