Exemple #1
0
        public Thrift <T> GetThift()
        {
            TSocket socket;

            while (true)
            {
                lock (loadBalancer)
                {
                    var thriftEndpoint = loadBalancer.Offer();
                    socket = thriftEndpoint.SocketPool.Acquire();
                    if (socket.TryOpen())
                    {
                        loadBalancer.OnOfferSucceeded();
                        break;
                    }

                    loadBalancer.OnOfferFailed();
                }
            }

            return(new Thrift <T>(socket, clientBuilder(socket)));
        }