示例#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.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;
        }
示例#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.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);
        }
示例#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;
        }
示例#6
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.addProxies_async(new AddProxiesCallback(this, proxy, callback), new Ice.ObjectPrx[] { proxy });
            return false;
        }
示例#7
0
 internal AddProxiesCallback(RouterInfo info, Ice.ObjectPrx prx, AddProxyCallback callback)
 {
     _info = info;
     _prx = prx;
     _callback = callback;
 }