org.ow2.cmi.lb.strategy
Class LoadFactorComparator<T extends org.ow2.cmi.lb.LoadBalanceable>

java.lang.Object
  extended by org.ow2.cmi.lb.strategy.LoadFactorComparator<T>
Type Parameters:
T - The type of objects that are load-balanced
All Implemented Interfaces:
java.util.Comparator<T>

public final class LoadFactorComparator<T extends org.ow2.cmi.lb.LoadBalanceable>
extends java.lang.Object
implements java.util.Comparator<T>

A comparator of load-factors.

Author:
The new CMI team

Constructor Summary
LoadFactorComparator(org.ow2.cmi.controller.common.ClusterViewManager clusterViewManager)
          Construct a comparator of load-factor.
 
Method Summary
 int compare(T loadBalanceable1, T loadBalanceable2)
          Compares the load-factors of two LoadBalanceable with the load factor of their ServerRef.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

LoadFactorComparator

public LoadFactorComparator(org.ow2.cmi.controller.common.ClusterViewManager clusterViewManager)
Construct a comparator of load-factor. The load-factors are provided by the ClusterViewManager.

Parameters:
clusterViewManager - the manager of the cluster view
Method Detail

compare

public int compare(T loadBalanceable1,
                   T loadBalanceable2)
Compares the load-factors of two LoadBalanceable with the load factor of their ServerRef.

Specified by:
compare in interface java.util.Comparator<T extends org.ow2.cmi.lb.LoadBalanceable>
Parameters:
loadBalanceable1 - the first LoadBalanceable
loadBalanceable2 - the second LoadBalanceable
Returns:
a negative integer, zero, or a positive integer as the first server has a smaller, equal to, or greater load-factor than than the second


Copyright © 2009 OW2 Consortium. All Rights Reserved.