示例#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));
            }
        }
示例#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)));
        }