示例#1
0
        public bool addProxy(Ice.ObjectPrx proxy, AddProxyCallback callback)
        {
            Debug.Assert(proxy != null);
            lock (this)
            {
                if (_identities.Contains(proxy.ice_getIdentity()))
                {
                    //
                    // Only add the proxy to the router if it's not already in our local map.
                    //
                    return(true);
                }
            }

            _router.addProxiesAsync(new Ice.ObjectPrx[] { proxy }).ContinueWith(
                (t) =>
            {
                try
                {
                    addAndEvictProxies(proxy, t.Result);
                    callback.addedProxy();
                }
                catch (System.AggregateException ae)
                {
                    Debug.Assert(ae.InnerException is Ice.LocalException);
                    callback.setException((Ice.LocalException)ae.InnerException);
                }
            });
            return(false);
        }
示例#2
0
        public bool addProxy(Ice.ObjectPrx proxy, AddProxyCallback callback)
        {
            Debug.Assert(proxy != null);
            lock (this)
            {
                if (_identities.Contains(proxy.ice_getIdentity()))
                {
                    //
                    // Only add the proxy to the router if it's not already in our local map.
                    //
                    return(true);
                }
            }
            _router.begin_addProxies(new Ice.ObjectPrx[] { proxy }).whenCompleted(
                (Ice.ObjectPrx[] evictedProxies) =>
            {
                addAndEvictProxies(proxy, evictedProxies);
                callback.addedProxy();
            },
                (Ice.Exception ex) =>
            {
                Debug.Assert(ex is Ice.LocalException);
                callback.setException((Ice.LocalException)ex);
            });

            return(false);
        }
示例#3
0
文件: RouterInfo.cs 项目: motuii/ice
        public bool addProxy(Ice.IObjectPrx proxy, AddProxyCallback callback)
        {
            Debug.Assert(proxy != null);
            lock (this)
            {
                if (!_hasRoutingTable)
                {
                    return(true); // The router implementation doesn't maintain a routing table.
                }
                if (_identities.Contains(proxy.Identity))
                {
                    //
                    // Only add the proxy to the router if it's not already in our local map.
                    //
                    return(true);
                }
            }

            _router.addProxiesAsync(new Ice.IObjectPrx[] { proxy }).ContinueWith(
                (t) =>
            {
                try
                {
                    addAndEvictProxies(proxy, t.Result);
                    callback.addedProxy();
                }
                catch (System.AggregateException ae)
                {
                    Debug.Assert(ae.InnerException is Ice.LocalException);
                    callback.setException((Ice.LocalException)ae.InnerException);
                }
            },
                System.Threading.Tasks.TaskScheduler.Current);
            return(false);
        }
示例#4
0
        public bool addProxy(Ice.ObjectPrx proxy, AddProxyCallback callback)
        {
            Debug.Assert(proxy != null);
            lock(this)
            {
                if(_identities.Contains(proxy.ice_getIdentity()))
                {
                    //
                    // Only add the proxy to the router if it's not already in our local map.
                    //
                    return true;
                }
            }
            _router.begin_addProxies(new Ice.ObjectPrx[] { proxy }).whenCompleted(
                (Ice.ObjectPrx[] evictedProxies) =>
                {
                    addAndEvictProxies(proxy, evictedProxies);
                    callback.addedProxy();
                },
                (Ice.Exception ex) =>
                {
                    Debug.Assert(ex is Ice.LocalException);
                    callback.setException((Ice.LocalException)ex);
                });

            return false;
        }
示例#5
0
        public bool addProxy(Ice.ObjectPrx proxy, AddProxyCallback callback)
        {
            Debug.Assert(proxy != null);
            lock(this)
            {
                if(_identities.Contains(proxy.ice_getIdentity()))
                {
                    //
                    // Only add the proxy to the router if it's not already in our local map.
                    //
                    return true;
                }
            }

            _router.addProxiesAsync(new Ice.ObjectPrx[] { proxy }).ContinueWith(
                (t) =>
                {
                    try
                    {
                        addAndEvictProxies(proxy, t.Result);
                        callback.addedProxy();
                    }
                    catch(System.AggregateException ae)
                    {
                        Debug.Assert(ae.InnerException is Ice.LocalException);
                        callback.setException((Ice.LocalException)ae.InnerException);
                    }
                });
            return false;
        }