// Returns locator info for a given locator. Automatically creates
        // the locator info if it doesn't exist yet.
        internal LocatorInfo GetLocatorInfo(ILocatorPrx loc)
        {
            // The locator can't be located.
            ILocatorPrx locator = loc.Clone(clearLocator: true);

            // TODO: reap unused locator info objects?
            lock (_locatorInfoMap)
            {
                if (!_locatorInfoMap.TryGetValue(locator, out LocatorInfo? info))
                {
                    // Rely on locator identity for the adapter table. We want to
                    // have only one table per locator (not one per locator
                    // proxy).
                    var key = new LocatorKey(locator);
                    if (!_locatorTableMap.TryGetValue(key, out LocatorTable? table))
                    {
                        table = new LocatorTable();
                        _locatorTableMap[key] = table;
                    }

                    info = new LocatorInfo(locator, table, _backgroundLocatorCacheUpdates);
                    _locatorInfoMap[locator] = info;
                }

                return(info);
            }
        }
Beispiel #2
0
            public override bool Equals(object o)
            {
                LocatorKey k = (LocatorKey)o;

                if (!k._id.Equals(_id))
                {
                    return(false);
                }
                if (!k._encoding.Equals(_encoding))
                {
                    return(false);
                }
                return(true);
            }
Beispiel #3
0
        //
        // Returns locator info for a given locator. Automatically creates
        // the locator info if it doesn't exist yet.
        //
        public LocatorInfo get(Ice.LocatorPrx loc)
        {
            if (loc == null)
            {
                return(null);
            }

            //
            // The locator can't be located.
            //
            Ice.LocatorPrx locator = Ice.LocatorPrxHelper.uncheckedCast(loc.ice_locator(null));

            //
            // TODO: reap unused locator info objects?
            //

            lock (this)
            {
                LocatorInfo info = null;
                if (!_table.TryGetValue(locator, out info))
                {
                    //
                    // Rely on locator identity for the adapter table. We want to
                    // have only one table per locator (not one per locator
                    // proxy).
                    //
                    LocatorTable table = null;
                    LocatorKey   key   = new LocatorKey(locator);
                    if (!_locatorTables.TryGetValue(key, out table))
                    {
                        table = new LocatorTable();
                        _locatorTables[key] = table;
                    }

                    info            = new LocatorInfo(locator, table, _background);
                    _table[locator] = info;
                }

                return(info);
            }
        }
Beispiel #4
0
        //
        // Returns locator info for a given locator. Automatically creates
        // the locator info if it doesn't exist yet.
        //
        public LocatorInfo get(ILocatorPrx loc)
        {
            if (loc == null)
            {
                throw new System.ArgumentNullException(nameof(loc));
            }

            //
            // The locator can't be located.
            //
            ILocatorPrx locator = loc.Clone(clearLocator: true);

            //
            // TODO: reap unused locator info objects?
            //
            lock (this)
            {
                LocatorInfo info;
                if (!_table.TryGetValue(locator, out info))
                {
                    //
                    // Rely on locator identity for the adapter table. We want to
                    // have only one table per locator (not one per locator
                    // proxy).
                    //
                    LocatorTable?table = null;
                    LocatorKey   key   = new LocatorKey(locator);
                    if (!_locatorTables.TryGetValue(key, out table))
                    {
                        table = new LocatorTable();
                        _locatorTables[key] = table;
                    }

                    info            = new LocatorInfo(locator, table, _background);
                    _table[locator] = info;
                }

                return(info);
            }
        }
Beispiel #5
0
        //
        // Returns locator info for a given locator. Automatically creates
        // the locator info if it doesn't exist yet.
        //
        public LocatorInfo get(Ice.LocatorPrx loc)
        {
            if(loc == null)
            {
                return null;
            }
            
            //
            // The locator can't be located.
            //
            Ice.LocatorPrx locator = Ice.LocatorPrxHelper.uncheckedCast(loc.ice_locator(null));

            //
            // TODO: reap unused locator info objects?
            //
            
            lock(this)
            {
                LocatorInfo info = null;
                if(!_table.TryGetValue(locator, out info))
                {
                    //
                    // Rely on locator identity for the adapter table. We want to
                    // have only one table per locator (not one per locator
                    // proxy).
                    //
                    LocatorTable table = null;
                    LocatorKey key = new LocatorKey(locator);
                    if(!_locatorTables.TryGetValue(key, out table))
                    {
                        table = new LocatorTable();
                        _locatorTables[key] = table;
                    }
                    
                    info = new LocatorInfo(locator, table, _background);
                    _table[locator] = info;
                }
                
                return info;
            }
        }