private IActorProxyFactory GetOrSetProxyFactory()

in src/Microsoft.ServiceFabric.Actors/Client/ActorProxyFactory.cs [242:295]


        private IActorProxyFactory GetOrSetProxyFactory(Type actorInterfaceType)
        {
#if !DotNetCoreClr

            // Use provider to find the stack
            if (this.proxyFactoryV1 == null && this.proxyFactoryV2 == null)
            {
                lock (this.thisLock)
                {
                        if (this.proxyFactoryV1 == null && this.proxyFactoryV2 == null)
                        {
                            var provider = this.GetProviderAttribute(actorInterfaceType);
                            if (Helper.IsEitherRemotingV2(provider.RemotingClientVersion))
                            {
                                // We are overriding listenerName since using provider service can have multiple listener configured for upgrade cases
                                this.OverrideDefaultListenerName(provider.RemotingClientVersion);
                                this.proxyFactoryV2 =
                                    new Remoting.V2.Client.ActorProxyFactory(provider.CreateServiceRemotingClientFactory, this.retrySettings);
                                return this.proxyFactoryV2;
                            }

                            this.proxyFactoryV1 =
                                new Remoting.V1.Client.ActorProxyFactory(provider.CreateServiceRemotingClientFactory, this.retrySettings);
                            return this.proxyFactoryV1;
                        }
                }
            }

            if (this.proxyFactoryV2 != null)
            {
                return this.proxyFactoryV2;
            }

            return this.proxyFactoryV1;

#else
            if (this.proxyFactoryV2 == null)
            {
                lock (this.thisLock)
                {
                    if (this.proxyFactoryV2 == null)
                    {
                        var provider = this.GetProviderAttribute(actorInterfaceType);
                        this.OverrideDefaultListenerName(provider.RemotingClientVersion);
                        this.proxyFactoryV2 =
                            new Remoting.V2.Client.ActorProxyFactory(provider.CreateServiceRemotingClientFactory, this.retrySettings);
                    }
                }
            }

            return this.proxyFactoryV2;
#endif

        }