站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 cluster API Documentation 英文版文档

FirstAvailable (JBoss Cluster API) - JBoss 4.0.1 sp1 cluster API Documentation 英文版文档


org.jboss.ha.framework.interfaces
Class FirstAvailable

java.lang.Object
  extended byorg.jboss.ha.framework.interfaces.FirstAvailable
All Implemented Interfaces:
LoadBalancePolicy, Serializable

public class FirstAvailable
extends Object
implements LoadBalancePolicy

LoadBalancingPolicy implementation that always favor the first available target i.e. no load balancing occurs. Nevertheless, the first target is randomly selected. This does not mean that fail-over will not occur if the first member in the list dies. In this case, fail-over will occur, and a new target will become the first member and invocation will continously be invoked on the same new target until its death. Each proxy using this policy will elect its own prefered target: the target is not shared accross the proxy family (for this behaviour please take a look at FirstAvailableIdenticalAllProxies)

Version:
$Revision: 1.5 $
Author:
Bill Burke., Sacha Labourey.
See Also:

Revisions:

2002/08/24: Sacha Labourey

  1. Use the target repository
  2. First choice is randomly selected to distribute the initial load
  3. When the list of targets change, we try to keep using the same previously elected target node if it still exists. Previously, we were working with the position id of the target node, thus if the list order changed, we were switching to another node while our prefered node was still up
, Serialized Form

Field Summary
protected  Object electedTarget
           
 
Constructor Summary
FirstAvailable()
           
 
Method Summary
 Object chooseTarget(FamilyClusterInfo clusterFamily)
          Called when the stub wishes to know on which node the next invocation must be performed.
 Object chooseTarget(FamilyClusterInfo clusterFamily, org.jboss.invocation.Invocation routingDecision)
          Called when the stub wishes to know on which node the next invocation must be performed.
 void init(HARMIClient father)
          Initialize the policy with a reference to its parent stub.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

electedTarget

protected transient Object electedTarget
Constructor Detail

FirstAvailable

public FirstAvailable()
Method Detail

init

public void init(HARMIClient father)
Description copied from interface: LoadBalancePolicy
Initialize the policy with a reference to its parent stub. the load-balancing policy implementation can use HARMIClient data to take its decision

Specified by:
init in interface LoadBalancePolicy
Parameters:
father - The stub that owns the policy

chooseTarget

public Object chooseTarget(FamilyClusterInfo clusterFamily)
Description copied from interface: LoadBalancePolicy
Called when the stub wishes to know on which node the next invocation must be performed.

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

chooseTarget

public Object chooseTarget(FamilyClusterInfo clusterFamily,
                           org.jboss.invocation.Invocation routingDecision)
Description copied from interface: LoadBalancePolicy
Called when the stub wishes to know on which node the next invocation must be performed.

Specified by:
chooseTarget in interface LoadBalancePolicy
Parameters:
clusterFamily - A list of potential target nodes
routingDecision - The actual invocation object if the policy wants to have some kind of invocation-based routing strategy
Returns:
The selected target for the next invocation


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.