public void maintainWeights() {
            ILoadBalancer lb = getLoadBalancer();
            if (lb == null) {
                return;
            }
            
            if (!serverWeightAssignmentInProgress.compareAndSet(false, true)) {
                return;
            }
            
            try {
                logger.info("Weight adjusting job started");
                AbstractLoadBalancer nlb = (AbstractLoadBalancer) lb;
                LoadBalancerStats stats = nlb.getLoadBalancerStats();
                if (stats == null) {
                    // no statistics, nothing to do
                    return;
                }
                double totalResponseTime = 0;
                // find maximal 95% response time
                for (Server server : nlb.getAllServers()) {
                    // this will automatically load the stats if not in cache
                    ServerStats ss = stats.getSingleServerStat(server);
                    totalResponseTime += ss.getResponseTimeAvg();
                }
                // weight for each server is (sum of responseTime of all servers - responseTime)
                // so that the longer the response time, the less the weight and the less likely to be chosen
                Double weightSoFar = 0.0;
                
                // create new list and hot swap the reference
                List<Double> finalWeights = new ArrayList<Double>();
                for (Server server : nlb.getAllServers()) {
                    ServerStats ss = stats.getSingleServerStat(server);
                    double weight = totalResponseTime - ss.getResponseTimeAvg();
                    weightSoFar += weight;
                    finalWeights.add(weightSoFar);   
                }
                setWeights(finalWeights);
            } catch (Exception e) {
                logger.error("Error calculating server weights", e);
            } finally {
                serverWeightAssignmentInProgress.set(false);
            }

        }
Rule that use the average/percentile response times
to assign dynamic "weights" per Server which is then used in 
the "Weighted Round Robin" fashion. 
<p>
The basic idea for weighted round robin has been obtained from JCS
The implementation for choosing the endpoint from the list of endpoints
is as follows:Let's assume 4 endpoints:A(wt=10), B(wt=30), C(wt=40), 
D(wt=20). 
<p>
Using the Random API, generate a random number between 1 and10+30+40+20.
Let's assume that the above list is randomized. Based on the weights, we
have intervals as follows:
<p>
1-----10 (A's weight)
<br>
11----40 (A's weight + B's weight)
<br>
41----80 (A's weight + B's weight + C's weight)
<br>
81----100(A's weight + B's weight + C's weight + C's weight)
<p>
Here's the psuedo code for deciding where to send the request:
<p>
if (random_number between 1 &amp; 10) {send request to A;}
<br>
else if (random_number between 11 &amp; 40) {send request to B;}
<br>
else if (random_number between 41 &amp; 80) {send request to C;}
<br>
else if (random_number between 81 &amp; 100) {send request to D;}
<p>
When there is not enough statistics gathered for the servers, this rule
will fall back to use {@link RoundRobinRule}. 
@author stonse

@deprecated Use {@link WeightedResponseTimeRule}

@see WeightedResponseTimeRule
ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ResponseTimeWeightedRule.java