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

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


org.jboss.ha.framework.interfaces
Class RandomRobin

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

public class RandomRobin
extends Object
implements LoadBalancePolicy

LoadBalancingPolicy implementation that always fully randomly select its target (without basing its decision on any historic).

Version:
$Revision: 1.4 $
Author:
Sacha Labourey.
See Also:
LoadBalancePolicy, Serialized Form

Field Summary
static Random localRandomizer
          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.
 
Constructor Summary
RandomRobin()
           
 
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

localRandomizer

public static final Random localRandomizer
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.

Constructor Detail

RandomRobin

public RandomRobin()
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.