You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by su...@apache.org on 2010/06/07 21:16:46 UTC
svn commit: r952374 -
/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/algorithms/WeightedRoundRobin.java
Author: supun
Date: Mon Jun 7 19:16:46 2010
New Revision: 952374
URL: http://svn.apache.org/viewvc?rev=952374&view=rev
Log:
improved some documentation
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/algorithms/WeightedRoundRobin.java
Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/algorithms/WeightedRoundRobin.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/algorithms/WeightedRoundRobin.java?rev=952374&r1=952373&r2=952374&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/algorithms/WeightedRoundRobin.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/algorithms/WeightedRoundRobin.java Mon Jun 7 19:16:46 2010
@@ -198,6 +198,9 @@ public class WeightedRoundRobin implemen
public void destroy() {}
+ /**
+ * Implementation of the thread local.
+ */
private class AlgorithmThreadLocal extends ThreadLocal<Algorithm> {
@Override
protected Algorithm initialValue() {
@@ -205,6 +208,10 @@ public class WeightedRoundRobin implemen
}
}
+ /**
+ * This is a thread local implementation of the algorith. This way indivudual threads will
+ * do their own weighted round robin without considering the global state of the endpoints
+ */
private class Algorithm {
/**
* We keep a sorted array of endpoint states, first state will point to the
@@ -254,10 +261,13 @@ public class WeightedRoundRobin implemen
* Simple class for holding the states about the endpoints.
*/
private class EndpointState {
+ /** Position of the endpoint, represented by this state */
private int endpointPosition = 0;
+ /** Weight of the endpoint */
private int weight = 0;
+ /** Current weight of the endpoint */
private int currentWeight = 0;
public EndpointState(int endpointPosition, int weight) {