예제 #1
0
        // Returns locator info for a given locator. Automatically creates the locator info if it doesn't exist yet.
        internal LocatorInfo?GetLocatorInfo(ILocatorPrx?locator, Encoding encoding)
        {
            if (locator == null)
            {
                return(null);
            }

            if (locator.Locator != null || locator.Encoding != encoding)
            {
                // The locator can't be located.
                locator = locator.Clone(clearLocator: true, encoding: encoding);
            }

            // 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);
            }
        }
예제 #2
0
 internal Request(LocatorInfo locatorInfo, Reference reference)
 {
     LocatorInfo = locatorInfo;
     Ref         = reference;
     _sent       = false;
     _response   = false;
 }
예제 #3
0
            public void Response(LocatorInfo locatorInfo, IObjectPrx?proxy)
            {
                IReadOnlyList <Endpoint>?endpoints = null;

                if (proxy != null)
                {
                    Reference r = proxy.IceReference;
                    if (_ref.IsWellKnown && _ref.Encoding != r.Encoding)
                    {
                        // If a well-known proxy and the returned proxy encoding don't match we're done:
                        // there's no compatible endpoint we can use.
                    }
                    else if (!r.IsIndirect)
                    {
                        endpoints = r.Endpoints;
                    }
                    else if (_ref.IsWellKnown && !r.IsWellKnown)
                    {
                        //
                        // We're resolving the endpoints of a well-known object and the proxy returned
                        // by the locator is an indirect proxy. We now need to resolve the endpoints
                        // of this indirect proxy.
                        //
                        if (_ref.Communicator.TraceLevels.Location >= 1)
                        {
                            Trace("retrieved adapter for well-known object from locator, adding to locator cache",
                                  _ref, r);
                        }
                        locatorInfo.GetEndpoints(r, _ref, _ttl, _callback);
                        return;
                    }
                }

                if (_ref.Communicator.TraceLevels.Location >= 1)
                {
                    GetEndpointsTrace(_ref, endpoints, false);
                }
                if (_callback != null)
                {
                    _callback.SetEndpoints(endpoints ?? Array.Empty <Endpoint>(), false);
                }
            }
예제 #4
0
 internal AdapterRequest(LocatorInfo locatorInfo, Reference reference)
     : base(locatorInfo, reference)
 {
 }
예제 #5
0
 internal ObjectRequest(LocatorInfo locatorInfo, Reference reference)
     : base(locatorInfo, reference)
 {
 }