Exemplo n.º 1
0
        public RequestHandler connect(Ice.ObjectPrxHelperBase proxy)
        {
            lock(this)
            {
                try
                {
                    if(!initialized())
                    {
                        _proxies.Add(proxy);
                    }
                }
                catch(Ice.LocalException ex)
                {
                    //
                    // Only throw if the connection didn't get established. If
                    // it died after being established, we allow the caller to
                    // retry the connection establishment by not throwing here.
                    //
                    if(_connection == null)
                    {
                        throw ex;
                    }
                }

                return proxy.setRequestHandler__(_requestHandler);
            }
        }
Exemplo n.º 2
0
        getRequestHandler(RoutableReference rf, Ice.ObjectPrxHelperBase proxy)
        {
            if(rf.getCollocationOptimized())
            {
                Ice.ObjectAdapter adapter = _instance.objectAdapterFactory().findObjectAdapter(proxy);
                if(adapter != null)
                {
                    return proxy.setRequestHandler__(new CollocatedRequestHandler(rf, adapter));
                }
            }

            bool connect = false;
            ConnectRequestHandler handler;
            if(rf.getCacheConnection())
            {
                lock(this)
                {
                    if(!_handlers.TryGetValue(rf, out handler))
                    {
                        handler = new ConnectRequestHandler(rf, proxy);
                        _handlers.Add(rf, handler);
                        connect = true;
                    }
                }
            }
            else
            {
                handler = new ConnectRequestHandler(rf, proxy);
                connect = true;
            }

            if(connect)
            {
                rf.getConnection(handler);
            }
            return proxy.setRequestHandler__(handler.connect(proxy));
        }
Exemplo n.º 3
0
        public RequestHandler connect(Ice.ObjectPrxHelperBase proxy)
        {
            //
            // Initiate the connection if connect() is called by the proxy that
            // created the handler.
            //
            if(Object.ReferenceEquals(proxy, _proxy) && _connect)
            {
                _connect = false; // Call getConnection only once
                _reference.getConnection(this);
            }

            try
            {
                lock(this)
                {
                    if(!initialized())
                    {
                        _proxies.Add(proxy);
                        return this;
                    }
                }
            }
            catch(Ice.LocalException ex)
            {
                throw ex;
            }

            if(_connectionRequestHandler != null)
            {
                proxy.setRequestHandler__(this, _connectionRequestHandler);
                return _connectionRequestHandler;
            }
            else
            {
                return this;                
            }
        }