org.objectweb.carol.cmi
Class Random

java.lang.Object
  extended byorg.objectweb.carol.cmi.Random

public class Random
extends java.lang.Object

You can use this helper class to get a randomized load balancing algorithm between clustered servers.

Author:
Simon Nieuviarts

Constructor Summary
Random()
          Constructor
Random(java.util.Set c)
          Builds a random algorithm on a Collection of StubData objects.
 
Method Summary
 StubData get()
          Get a stub randomly
 void update(java.util.Set stubs)
          Update the set of stub only if different from the last update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Random

public Random()
Constructor


Random

public Random(java.util.Set c)
Builds a random algorithm on a Collection of StubData objects.

Parameters:
c - a Collection of StubData objects.
Method Detail

update

public void update(java.util.Set stubs)
Update the set of stub only if different from the last update

Parameters:
stubs - set of stub

get

public StubData get()
             throws NoServerException
Get a stub randomly

Returns:
stub
Throws:
NoServerException - if no stub available