FileDocCategorySizeDatePackage
RoundRobin.javaAPI DocJBoss 4.2.12922Fri Jul 13 20:52:38 BST 2007org.jboss.ha.framework.interfaces

RoundRobin

public class RoundRobin extends Object implements LoadBalancePolicy
LoadBalancingPolicy implementation that always favor the next available target load balancing always occurs.
see
org.jboss.ha.framework.interfaces.LoadBalancePolicy
author
Sacha Labourey.
author
Bill Burke.
version
$Revision: 57188 $

Fields Summary
private static final long
serialVersionUID
Constructors Summary
Methods Summary
public java.lang.ObjectchooseTarget(FamilyClusterInfo clusterFamily)

      return this.chooseTarget(clusterFamily, null);
   
public java.lang.ObjectchooseTarget(FamilyClusterInfo clusterFamily, org.jboss.invocation.Invocation routingDecision)

      int cursor = clusterFamily.getCursor ();
      ArrayList targets = clusterFamily.getTargets ();

      if (targets.size () == 0)
         return null;
      
      if (cursor == FamilyClusterInfo.UNINITIALIZED_CURSOR)
      {         
         // Obtain a random index into targets
         cursor = RandomRobin.localRandomizer.nextInt(targets.size());
      }
      else
      {
         // Choose the next target
         cursor = ( (cursor + 1) % targets.size() );
      }
      clusterFamily.setCursor (cursor);

      return targets.get(cursor);
   
public voidinit(HARMIClient father)


   // Attributes ----------------------------------------------------
   
   // Static --------------------------------------------------------
   
   // Constructors --------------------------------------------------
       
   // Public --------------------------------------------------------
   
       
   
      // do not use the HARMIClient in this policy