org.jboss.ha.client.loadbalance
Class FirstAvailable
java.lang.Object
org.jboss.ha.client.loadbalance.FirstAvailable
- All Implemented Interfaces:
- Serializable, LoadBalancePolicy
- Direct Known Subclasses:
- FirstAvailable
public class FirstAvailable
- extends Object
- implements LoadBalancePolicy
LoadBalancePolicy implementation that, once a target is chosen, always favors
that same target; i.e. no further load balancing occurs. Useful in cases where
"sticky session" behavior is desired. Initially the favored
target is randomly selected, so different instances of this class
will likely not all select the same target; thus load balancing does occur
across different proxies. Favoring the same target does not
mean that fail-over will not occur if the chosen target dies. In this case,
fail-over will occur, and a new favored target will be randomly chosen and
invocation will continously be invoked on this new target until its death.
Each proxy using this policy will choose its own
preferred target: the target is not shared accross the proxy family. For
shared behaviour please take a look at
FirstAvailableIdenticalAllProxies
.
- Version:
- $Revision: 57642 $
- Author:
- Bill Burke., 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 |
electedTarget
protected Object electedTarget
FirstAvailable
public FirstAvailable()
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
electTarget
protected Object electTarget(List targets)
Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.