org.jboss.ha.client.loadbalance
Class RandomRobin
java.lang.Object
org.jboss.ha.client.loadbalance.RandomRobin
- All Implemented Interfaces:
- Serializable, LoadBalancePolicy
public class RandomRobin
- extends Object
- implements LoadBalancePolicy
LoadBalancePolicy implementation that always fully randomly selects its target
(without basing its decision on any history).
- Version:
- $Revision: 57642 $
- Author:
- Sacha Labourey., brian.stansberry@jboss.com
- See Also:
LoadBalancePolicy
,
Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
localRandomizer
public static final Random localRandomizer
Random
used to pick the target.
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.
We make this public so other LoadBalancePolicy implementations can
use it.
RandomRobin
public RandomRobin()
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.