コード例 #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
ファイル: EndpointI.cs プロジェクト: skyhack1212/ice-1
 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
ファイル: ConnectionI.cs プロジェクト: alexmnazarenko/ice
        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
ファイル: ConnectionI.cs プロジェクト: alexmnazarenko/ice
 internal void completed(LocalException ex)
 {
     if(outAsync != null)
     {
         Ice.AsyncCallback cb = outAsync.completed(ex);
         if(cb != null)
         {
             outAsync.invokeCompleted(cb);
         }
     }
 }
コード例 #8
0
ファイル: ConnectionI.cs プロジェクト: alexmnazarenko/ice
        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
ファイル: ConnectionI.cs プロジェクト: alexmnazarenko/ice
 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
ファイル: ConnectionI.cs プロジェクト: sbesson/zeroc-ice
 internal void finished(LocalException ex)
 {
     if(@out != null)
     {
         @out.finished(ex, isSent);
     }
     else if(outAsync != null)
     {
         outAsync.finished__(ex, isSent);
     }
 }
コード例 #13
0
ファイル: ConnectionI.cs プロジェクト: sbesson/zeroc-ice
        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
ファイル: ConnectionI.cs プロジェクト: sbesson/zeroc-ice
 public void exception(LocalException ex)
 {
     _m.Lock();
     try
     {
         setState(StateClosed, ex);
     }
     finally
     {
         _m.Unlock();
     }
 }
コード例 #15
0
ファイル: ConnectionI.cs プロジェクト: zhangwei5095/ice
 internal void completed(LocalException ex)
 {
     if(outAsync != null)
     {
         if(outAsync.exception(ex))
         {
             outAsync.invokeException();
         }
     }
     stream = null;
 }
コード例 #16
0
ファイル: Proxy.cs プロジェクト: Radulfr/zeroc-ice
        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;
            }
        }