Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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;
        }