org.jboss.ha.client.loadbalance
Class RoundRobin

java.lang.Object
  extended by org.jboss.ha.client.loadbalance.RoundRobin
All Implemented Interfaces:
Serializable, LoadBalancePolicy

public class RoundRobin
extends Object
implements LoadBalancePolicy

LoadBalancePolicy implementation that always favors the next available target in the list, ensuring maximum load balancing always occurs.

Different instances of this class will coordinate their target selection via the FamilyClusterInfo cursor, so if proxy A makes the first call to target 1, and proxy B makes the next call, it will invoke on target 2; the third call will go to target 3 no matter which proxy makes it, and so on.

The first target in the round-robin is chosen randomly, ensuring that proper load balancing occurs when many clients in different VM's download the proxy.

Version:
$Revision: 57642 $
Author:
Sacha Labourey., Bill Burke.
See Also:
LoadBalancePolicy, FamilyClusterInfo.getCursor(), Serialized Form

Constructor Summary
RoundRobin()
           
 
Method Summary
 Object chooseTarget(FamilyClusterInfo clusterFamily)
          Gets the target for the next remote call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoundRobin

public RoundRobin()
Method Detail

chooseTarget

public Object chooseTarget(FamilyClusterInfo clusterFamily)
Description copied from interface: LoadBalancePolicy
Gets the target for the next remote call.

Called when the client wishes to know on which node the next invocation must be performed.

Specified by:
chooseTarget in interface LoadBalancePolicy
Parameters:
clusterFamily - object encapsulating a list of potential target nodes
Returns:
The selected target for the next invocation


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.