org.jboss.ha.framework.interfaces
Class RandomRobin

java.lang.Object
  extended byorg.jboss.ha.framework.interfaces.RandomRobin
All Implemented Interfaces:
LoadBalancePolicy (src) , java.io.Serializable

public class RandomRobin
extends java.lang.Object
implements LoadBalancePolicy (src)

LoadBalancingPolicy implementation that always fully randomly select its target (without basing its decision on any historic).

See Also:
LoadBalancePolicy (src) , Serialized Form

Field Summary
static java.util.Random localRandomizer
          This needs to be a class variable or else you end up with multiple Random numbers with the same seed when many clients lookup a proxy.
 
Constructor Summary
RandomRobin()
           
 
Method Summary
 java.lang.Object chooseTarget(FamilyClusterInfo (src)  clusterFamily)
          Called when the stub wishes to know on which node the next invocation must be performed.
 java.lang.Object chooseTarget(FamilyClusterInfo (src)  clusterFamily, Invocation (src)  routingDecision)
          Called when the stub wishes to know on which node the next invocation must be performed.
 void init(HARMIClient (src)  father)
          Initialize the policy with a reference to its parent stub.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localRandomizer

public static final java.util.Random localRandomizer
This needs to be a class variable or else you end up with multiple Random numbers with the same seed when many clients lookup a proxy.

Constructor Detail

RandomRobin

public RandomRobin()
Method Detail

init

public void init(HARMIClient (src)  father)
Description copied from interface: LoadBalancePolicy (src)
Initialize the policy with a reference to its parent stub. the load-balancing policy implementation can use HARMIClient data to take its decision

Specified by:
init in interface LoadBalancePolicy (src)
Parameters:
father - The stub that owns the policy

chooseTarget

public java.lang.Object chooseTarget(FamilyClusterInfo (src)  clusterFamily)
Description copied from interface: LoadBalancePolicy (src)
Called when the stub wishes to know on which node the next invocation must be performed.

Specified by:
chooseTarget in interface LoadBalancePolicy (src)
Parameters:
clusterFamily - A list of potential target nodes
Returns:
The selected target for the next invocation

chooseTarget

public java.lang.Object chooseTarget(FamilyClusterInfo (src)  clusterFamily,
                                     Invocation (src)  routingDecision)
Description copied from interface: LoadBalancePolicy (src)
Called when the stub wishes to know on which node the next invocation must be performed.

Specified by:
chooseTarget in interface LoadBalancePolicy (src)
Parameters:
clusterFamily - A list of potential target nodes
routingDecision - The actual invocation object if the policy wants to have some kind of invocation-based routing strategy
Returns:
The selected target for the next invocation