示例#1
0
        public ILocatorRegistryPrx getLocatorRegistry()
        {
            lock (this)
            {
                if (_locatorRegistry != null)
                {
                    return(_locatorRegistry);
                }
            }

            //
            // Do not make locator calls from within sync.
            //
            ILocatorRegistryPrx locatorRegistry = _locator.GetRegistry();

            if (locatorRegistry == null)
            {
                return(null);
            }

            lock (this)
            {
                //
                // The locator registry can't be located. We use ordered
                // endpoint selection in case the locator returned a proxy
                // with some endpoints which are prefered to be tried first.
                //
                _locatorRegistry = locatorRegistry.Clone(clearLocator: true, endpointSelectionType: EndpointSelectionType.Ordered);
                return(_locatorRegistry);
            }
        }
示例#2
0
        // TODO: returning a null locator registry is ok?
        // Encoding represents the encoding used to send the getRegistry request.
        internal async ValueTask <ILocatorRegistryPrx?> GetLocatorRegistryAsync(Encoding encoding)
        {
            if (_locatorRegistry == null)
            {
                ILocatorRegistryPrx?prx =
                    await Locator.Clone(encoding : encoding).GetRegistryAsync().ConfigureAwait(false);

                // The locator registry can't be located and we use ordered endpoint selection in case the locator
                // returned a proxy with some endpoints which are preferred to be tried first.
                _locatorRegistry = prx?.Clone(clearLocator: true, endpointSelection: EndpointSelectionType.Ordered);
            }
            return(_locatorRegistry);
        }