Ejemplo n.º 1
0
 public void setRequestHandler__(ObjectDel_ @delegate, IceInternal.RequestHandler handler)
 {
     lock(this)
     {
         if(@delegate == _delegate)
         {
             if(_delegate is ObjectDelM_)
             {
                 _delegate = createDelegateM__();
                 _delegate.setRequestHandler__(handler);
             }
             else if(_delegate is ObjectDelD_)
             {
                 _delegate = createDelegateD__();
                 _delegate.setRequestHandler__(handler);
             }
         }
     }
 }
Ejemplo n.º 2
0
        public int handleExceptionWrapper__(ObjectDel_ @delegate, IceInternal.LocalExceptionWrapper ex)
        {
            lock(this)
            {
                if(@delegate == _delegate)
                {
                    _delegate = null;
                }
            }

            if(!ex.retry())
            {
                throw ex.get();
            }

            return 0;
        }
Ejemplo n.º 3
0
        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;
            }
        }
Ejemplo n.º 4
0
        public int handleExceptionWrapperRelaxed__(ObjectDel_ @delegate, IceInternal.LocalExceptionWrapper ex,
                                                   bool sleep, ref int cnt)
        {
            if(!ex.retry())
            {
                return handleException__(@delegate, ex.get(), sleep, ref cnt);
            }
            else
            {
                lock(this)
                {
                    if(@delegate == _delegate)
                    {
                        _delegate = null;
                    }
                }

                return 0;
            }
        }
Ejemplo n.º 5
0
 public ObjectDel_ getDelegate__(bool ami)
 {
     if(_reference.getCacheConnection())
     {
         lock(this)
         {
             if(_delegate != null)
             {
                 return _delegate;
             }
             // Connect asynchrously to avoid blocking with the proxy mutex locked.
             _delegate = createDelegate(true);
             return _delegate;
         }
     }
     else
     {
         IceInternal.Reference.Mode mode = _reference.getMode();
         return createDelegate(ami ||
                               mode == IceInternal.Reference.Mode.ModeBatchOneway ||
                               mode == IceInternal.Reference.Mode.ModeBatchDatagram);
     }
 }
Ejemplo n.º 6
0
        public void copyFrom__(ObjectPrx from)
        {
            ObjectPrxHelperBase h = (ObjectPrxHelperBase)from;
            IceInternal.Reference @ref = null;
            ObjectDelM_ delegateM = null;
            ObjectDelD_ delegateD = null;

            lock(from)
            {
                @ref = h._reference;
                delegateM = h._delegate as ObjectDelM_;
                delegateD = h._delegate as ObjectDelD_;
            }

            //
            // No need to synchronize "*this", as this operation is only
            // called upon initialization.
            //

            Debug.Assert(_reference == null);
            Debug.Assert(_delegate == null);

            _reference = @ref;

            if(_reference.getCacheConnection())
            {
                //
                // The _delegate attribute is only used if "cache connection"
                // is enabled. If it's not enabled, we don't keep track of the
                // delegate -- a new delegate is created for each invocations.
                //

                if(delegateD != null)
                {
                    ObjectDelD_ @delegate = createDelegateD__();
                    @delegate.copyFrom__(delegateD);
                    _delegate = @delegate;
                }
                else if(delegateM != null)
                {
                    ObjectDelM_ @delegate = createDelegateM__();
                    @delegate.copyFrom__(delegateM);
                    _delegate = @delegate;
                }
            }
        }
Ejemplo n.º 7
0
        public int handleExceptionWrapper__(ObjectDel_ @delegate, IceInternal.LocalExceptionWrapper ex,
                                            InvocationObserver obsv)
        {
            lock(this)
            {
                if(@delegate == _delegate)
                {
                    _delegate = null;
                }
            }

            if(!ex.retry())
            {
                if(obsv != null)
                {
                    obsv.failed(ex.get().ice_name());
                }
                throw ex.get();
            }

            return 0;
        }
Ejemplo n.º 8
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;
            }
        }