Beispiel #1
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 #2
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 = (LocatorInfo)_table[locator];
                if(info == null)
                {
                    //
                    // Rely on locator identity for the adapter table. We want to
                    // have only one table per locator (not one per locator
                    // proxy).
                    //
                    LocatorTable table = (LocatorTable)_locatorTables[locator.ice_getIdentity()];
                    if(table == null)
                    {
                        table = new LocatorTable();
                        _locatorTables[locator.ice_getIdentity()] = table;
                    }

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

                return info;
            }
        }
Beispiel #3
0
 internal LocatorInfo(Ice.LocatorPrx locator, LocatorTable table, bool background)
 {
     _locator = locator;
     _table = table;
     _background = background;
 }
Beispiel #4
0
 internal LocatorInfo(Ice.LocatorPrx locator, LocatorTable table, bool background)
 {
     _locator    = locator;
     _table      = table;
     _background = background;
 }