org.jboss.soa.esb.listeners.ha
Class RandomRobin

java.lang.Object
  extended by org.jboss.soa.esb.listeners.ha.RandomRobin
All Implemented Interfaces:
LoadBalancePolicy

public class RandomRobin
extends java.lang.Object
implements LoadBalancePolicy

LoadBalancingPolicy implementation that always fully randomly select its epr (without basing its decision on any historic). Code based on jbossas ha framework.

Author:
Kurt Stam.

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
 EPR chooseEPR(ServiceClusterInfo serviceCluster)
          Called when the ServiceInvoker wishes to know on which node the next invocation must be performed.
 
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

chooseEPR

public EPR chooseEPR(ServiceClusterInfo serviceCluster)
Description copied from interface: LoadBalancePolicy
Called when the ServiceInvoker wishes to know on which node the next invocation must be performed.

Specified by:
chooseEPR in interface LoadBalancePolicy
Parameters:
serviceCluster - A list of potential eprs
Returns:
The selected epr for the next invocation