예제 #1
0
파일: Outgoing.cs 프로젝트: stick/zeroc-ice
 public BatchOutgoing(Ice.ConnectionI connection, Instance instance, InvocationObserver observer)
 {
     _connection = connection;
     _sent       = false;
     _observer   = observer;
     _os         = new BasicStream(instance, Ice.Util.currentProtocolEncoding);
 }
예제 #2
0
파일: Outgoing.cs 프로젝트: stick/zeroc-ice
 public BatchOutgoing(RequestHandler handler, InvocationObserver observer)
 {
     _handler  = handler;
     _sent     = false;
     _observer = observer;
     _os       = new BasicStream(handler.getReference().getInstance(), Ice.Util.currentProtocolEncoding);
     Protocol.checkSupportedProtocol(handler.getReference().getProtocol());
 }
예제 #3
0
 GetInvocationObserver(Ice.IObjectPrx?p, string op, IReadOnlyDictionary <string, string> ctx)
 {
     lock (this)
     {
         if (invocationObserver == null)
         {
             invocationObserver = new InvocationObserver();
             invocationObserver.reset();
         }
         return(invocationObserver);
     }
 }
예제 #4
0
        //
        // These functions allow this object to be reused, rather than reallocated.
        //
        public void reset(RequestHandler handler, string operation, Ice.OperationMode mode,
                          Dictionary<string, string> context, InvocationObserver observer)
        {
            _state = StateUnsent;
            _exception = null;
            _sent = false;
            _handler = handler;
            _observer = observer;
            _encoding = Protocol.getCompatibleEncoding(handler.getReference().getEncoding());

            Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_handler.getReference().getProtocol()));

            writeHeader(operation, mode, context);
        }
예제 #5
0
파일: Outgoing.cs 프로젝트: stick/zeroc-ice
        public Outgoing(RequestHandler handler, string operation, Ice.OperationMode mode,
                        Dictionary <string, string> context, InvocationObserver observer)
        {
            _state    = StateUnsent;
            _sent     = false;
            _handler  = handler;
            _observer = observer;
            _encoding = Protocol.getCompatibleEncoding(handler.getReference().getEncoding());
            _os       = new BasicStream(_handler.getReference().getInstance(), Ice.Util.currentProtocolEncoding);

            Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_handler.getReference().getProtocol()));

            writeHeader(operation, mode, context);
        }
예제 #6
0
파일: Outgoing.cs 프로젝트: stick/zeroc-ice
        //
        // These functions allow this object to be reused, rather than reallocated.
        //
        public void reset(RequestHandler handler, string operation, Ice.OperationMode mode,
                          Dictionary <string, string> context, InvocationObserver observer)
        {
            _state     = StateUnsent;
            _exception = null;
            _sent      = false;
            _handler   = handler;
            _observer  = observer;
            _encoding  = Protocol.getCompatibleEncoding(handler.getReference().getEncoding());

            Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_handler.getReference().getProtocol()));

            writeHeader(operation, mode, context);
        }
예제 #7
0
        public Outgoing(RequestHandler handler, string operation, Ice.OperationMode mode,
                        Dictionary<string, string> context, InvocationObserver observer)
        {
            _state = StateUnsent;
            _sent = false;
            _handler = handler;
            _observer = observer;
            _encoding = Protocol.getCompatibleEncoding(handler.getReference().getEncoding());
            _os = new BasicStream(_handler.getReference().getInstance(), Ice.Util.currentProtocolEncoding);

            Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_handler.getReference().getProtocol()));

            writeHeader(operation, mode, context);
        }
예제 #8
0
        public static InvocationObserver?get(Ice.Communicator communicator, string op)
        {
            CommunicatorObserver?obsv = communicator.Observer;

            if (obsv != null)
            {
                InvocationObserver observer = obsv.getInvocationObserver(null, op, _emptyContext);
                if (observer != null)
                {
                    observer.attach();
                }
                return(observer);
            }
            return(null);
        }
예제 #9
0
        static public InvocationObserver get(Instance instance, string op)
        {
            CommunicatorObserver obsv = instance.initializationData().observer;

            if (obsv != null)
            {
                InvocationObserver observer = obsv.getInvocationObserver(null, op, _emptyContext);
                if (observer != null)
                {
                    observer.attach();
                }
                return(observer);
            }
            return(null);
        }
예제 #10
0
        public Outgoing getOutgoing(string operation, Ice.OperationMode mode, Dictionary <string, string> context,
                                    InvocationObserver observer)
        {
            _m.Lock();
            try
            {
                if (!initialized())
                {
                    return(new IceInternal.Outgoing(this, operation, mode, context, observer));
                }
            }
            finally
            {
                _m.Unlock();
            }

            return(_connection.getOutgoing(this, operation, mode, context, observer));
        }
예제 #11
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;
            }
        }
예제 #12
0
 public Outgoing getOutgoing(string operation, Ice.OperationMode mode, Dictionary <string, string> context,
                             InvocationObserver observer)
 {
     return(_connection.getOutgoing(this, operation, mode, context, observer));
 }
예제 #13
0
파일: Proxy.cs 프로젝트: Radulfr/zeroc-ice
 public int handleExceptionWrapperRelaxed__(ObjectDel_ @delegate, IceInternal.LocalExceptionWrapper ex,
                                            bool sleep, ref int cnt, InvocationObserver obsv)
 {
     if(!ex.retry())
     {
         return handleException__(@delegate, ex.get(), sleep, ref cnt, obsv);
     }
     else
     {
         lock(this)
         {
             if(@delegate == _delegate)
             {
                 _delegate = null;
             }
         }
         return 0;
     }
 }
예제 #14
0
파일: Proxy.cs 프로젝트: Radulfr/zeroc-ice
 public virtual bool ice_isA(string id__, Dictionary<string, string> context__, InvocationObserver obsv__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing(ObjectPrxHelperBase.__ice_isA_name, 
                                                       OperationMode.Nonmutating, context__, obsv__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.startWriteParams(FormatType.DefaultFormat);
             os__.writeString(id__);
             og__.endWriteParams();
         }
         catch(LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         try
         {
             if(!ok__)
             {
                 try
                 {
                     og__.throwUserException();
                 }
                 catch(UserException ex)
                 {
                     throw new UnknownUserException(ex.ice_name(), ex);
                 }
             }
             IceInternal.BasicStream is__ = og__.startReadParams();
             bool ret__ = is__.readBool();
             og__.endReadParams();
             return ret__;
         }
         catch(LocalException ex__)
         {
             throw new IceInternal.LocalExceptionWrapper(ex__, false);
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
예제 #15
0
파일: Proxy.cs 프로젝트: Radulfr/zeroc-ice
 public virtual void ice_flushBatchRequests(InvocationObserver obsv)
 {
     throw new CollocationOptimizationException();
 }
예제 #16
0
파일: Proxy.cs 프로젝트: Radulfr/zeroc-ice
 public virtual bool ice_invoke(string operation, OperationMode mode, byte[] inEncaps,
                                out byte[] outEncaps, Dictionary<string, string> context,
                                InvocationObserver obsv)
 {
     throw new CollocationOptimizationException();
 }
예제 #17
0
파일: Proxy.cs 프로젝트: Radulfr/zeroc-ice
        public virtual string ice_id(Dictionary<string, string> context__, InvocationObserver obsv__)
        {
            Current current__ = new Current();
            initCurrent__(ref current__, ObjectPrxHelperBase.__ice_id_name, OperationMode.Nonmutating, context__);

            string result__ = null;
            IceInternal.Direct.RunDelegate run__ = delegate(Object servant__)
            {
                result__ = servant__.ice_id(current__);
                return Ice.DispatchStatus.DispatchOK;
            };

            IceInternal.Direct direct__ = null;
            try
            {
                direct__ = new IceInternal.Direct(current__, run__);
            }
            catch(System.Exception ex__)
            {
                IceInternal.LocalExceptionWrapper.throwWrapper(ex__);
            }

            try
            {
                DispatchStatus status__ = direct__.getServant().collocDispatch__(direct__);
                Debug.Assert(status__ == DispatchStatus.DispatchOK);
                return result__;
            }
            finally
            {
                try
                {
                    direct__.destroy();
                }
                catch(System.Exception ex__)
                {
                    IceInternal.LocalExceptionWrapper.throwWrapper(ex__);
                }
            }
        }
예제 #18
0
        public IceInternal.Outgoing getOutgoing(IceInternal.RequestHandler handler, string operation,
                                                OperationMode mode, Dictionary<string, string> context,
                                                InvocationObserver observer)
        {
            IceInternal.Outgoing og = null;

            if(_cacheBuffers)
            {
                lock(_outgoingCacheMutex)
                {
                    if(_outgoingCache == null)
                    {
                        og = new IceInternal.Outgoing(handler, operation, mode, context, observer);
                    }
                    else
                    {
                        og = _outgoingCache;
                        _outgoingCache = _outgoingCache.next;
                        og.reset(handler, operation, mode, context, observer);
                        og.next = null;
                    }
                }
            }
            else
            {
                og = new IceInternal.Outgoing(handler, operation, mode, context, observer);
            }

            return og;
        }
예제 #19
0
 public BatchOutgoing(Ice.ConnectionI connection, Instance instance, InvocationObserver observer)
 {
     _connection = connection;
     _sent = false;
     _observer = observer;
     _os = new BasicStream(instance, Ice.Util.currentProtocolEncoding);
 }
예제 #20
0
파일: Proxy.cs 프로젝트: Radulfr/zeroc-ice
 public virtual void ice_ping(Dictionary<string, string> context__, InvocationObserver obsv__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing(ObjectPrxHelperBase.__ice_ping_name, 
                                                       OperationMode.Nonmutating, context__, obsv__);
     try
     {
         og__.writeEmptyParams();
         bool ok__ = og__.invoke();
         if(og__.hasResponse())
         {
             try
             {
                 if(!ok__)
                 {
                     try
                     {
                         og__.throwUserException();
                     }
                     catch(UserException ex)
                     {
                         throw new UnknownUserException(ex.ice_name(), ex);
                     }
                 }
                 og__.readEmptyParams();
             }
             catch(LocalException ex__)
             {
                 throw new IceInternal.LocalExceptionWrapper(ex__, false);
             }
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
예제 #21
0
파일: Proxy.cs 프로젝트: Radulfr/zeroc-ice
        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;
        }
예제 #22
0
        public Outgoing getOutgoing(string operation, Ice.OperationMode mode, Dictionary<string, string> context,
                                    InvocationObserver observer)
        {
            _m.Lock();
            try
            {
                if(!initialized())
                {
                    return new IceInternal.Outgoing(this, operation, mode, context, observer);
                }
            }
            finally
            {
                _m.Unlock();
            }

            return _connection.getOutgoing(this, operation, mode, context, observer);
        }
예제 #23
0
파일: Proxy.cs 프로젝트: Radulfr/zeroc-ice
 public virtual string ice_id(Dictionary<string, string> context__, InvocationObserver obsv__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing(ObjectPrxHelperBase.__ice_id_name,
                                                       OperationMode.Nonmutating, context__, obsv__);
     try
     {
         og__.writeEmptyParams();
         bool ok__ = og__.invoke();
         try
         {
             if(!ok__)
             {
                 try
                 {
                     og__.throwUserException();
                 }
                 catch(UserException ex)
                 {
                     throw new UnknownUserException(ex.ice_name(), ex);
                 }
             }
             IceInternal.BasicStream is__ = og__.startReadParams();
             string ret__ = is__.readString();
             og__.endReadParams();
             return ret__;
         }
         catch(LocalException ex__)
         {
             throw new IceInternal.LocalExceptionWrapper(ex__, false);
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
예제 #24
0
파일: Proxy.cs 프로젝트: Radulfr/zeroc-ice
 public virtual bool ice_invoke(string operation, OperationMode mode, byte[] inEncaps, out byte[] outEncaps,
                                Dictionary<string, string> context__, InvocationObserver obsv__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing(operation, mode, context__, obsv__);
     try
     {
         try
         {
             og__.writeParamEncaps(inEncaps);
         }
         catch(LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok = og__.invoke();
         outEncaps = null;
         if(handler__.getReference().getMode() == IceInternal.Reference.Mode.ModeTwoway)
         {
             try
             {
                 outEncaps = og__.readParamEncaps();
             }
             catch(LocalException ex__)
             {
                 throw new IceInternal.LocalExceptionWrapper(ex__, false);
             }
         }
         return ok;
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
예제 #25
0
파일: Proxy.cs 프로젝트: Radulfr/zeroc-ice
 public virtual void ice_flushBatchRequests(InvocationObserver obsv)
 {
     IceInternal.BatchOutgoing @out = new IceInternal.BatchOutgoing(handler__, obsv);
     @out.invoke();
 }
예제 #26
0
 public BatchOutgoing(RequestHandler handler, InvocationObserver observer)
 {
     _handler = handler;
     _sent = false;
     _observer = observer;
     _os = new BasicStream(handler.getReference().getInstance(), Ice.Util.currentProtocolEncoding);
     Protocol.checkSupportedProtocol(handler.getReference().getProtocol());
 }
예제 #27
0
 public Outgoing getOutgoing(string operation, Ice.OperationMode mode, Dictionary<string, string> context,
                             InvocationObserver observer)
 {
     return _connection.getOutgoing(this, operation, mode, context, observer);
 }