org.ow2.carol.cmi.lb.policy
Class RoundRobinPolicy<T extends org.ow2.carol.cmi.lb.LoadBalanceable>

java.lang.Object
  extended by org.ow2.carol.cmi.lb.policy.AbsLBPolicy<T>
      extended by org.ow2.carol.cmi.lb.policy.RoundRobinPolicy<T>
Type Parameters:
T - The type of object that was load-balanced
All Implemented Interfaces:
org.ow2.carol.cmi.lb.policy.ILBPolicy<T>

@ThreadSafe
public final class RoundRobinPolicy<T extends org.ow2.carol.cmi.lb.LoadBalanceable>
extends AbsLBPolicy<T>

The default load-balancing policy (Round Robin) that always chooses the next available load-balanceable.

Author:
The new CMI team

Constructor Summary
RoundRobinPolicy()
          Build the Round Robin policy.
 
Method Summary
 T choose(java.util.List<T> loadBalanceables)
          Chooses the next load-balanceable among the list of load-balanceables.
 java.lang.String toString()
           
 
Methods inherited from class org.ow2.carol.cmi.lb.policy.AbsLBPolicy
getLBStrategy, onInvokeException, onLookupException, onReturn, setClusterViewManager, setLBStrategy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RoundRobinPolicy

public RoundRobinPolicy()
Build the Round Robin policy. Give to the pointer an initial value.

Method Detail

choose

public T choose(java.util.List<T> loadBalanceables)
                                                      throws org.ow2.carol.cmi.lb.NoLoadBalanceableException
Chooses the next load-balanceable among the list of load-balanceables.

Specified by:
choose in interface org.ow2.carol.cmi.lb.policy.ILBPolicy<T extends org.ow2.carol.cmi.lb.LoadBalanceable>
Specified by:
choose in class AbsLBPolicy<T extends org.ow2.carol.cmi.lb.LoadBalanceable>
Parameters:
loadBalanceables - the list of load-balanceables
Returns:
the chosen load-balanceable
Throws:
org.ow2.carol.cmi.lb.NoLoadBalanceableException - if no server available

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008 OW2 Consortium. All Rights Reserved.