org.objectweb.cjdbc.controller.loadbalancer.policies.errorchecking
Class ErrorCheckingRandom

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.loadbalancer.policies.errorchecking.ErrorCheckingPolicy
      extended byorg.objectweb.cjdbc.controller.loadbalancer.policies.errorchecking.ErrorCheckingRandom

public class ErrorCheckingRandom
extends ErrorCheckingPolicy

Chooses numberOfNodes nodes randomly for error checking.

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
private  java.util.Random random
           
 
Fields inherited from class org.objectweb.cjdbc.controller.loadbalancer.policies.errorchecking.ErrorCheckingPolicy
ALL, nbOfNodes, policy, RANDOM, ROUND_ROBIN
 
Constructor Summary
ErrorCheckingRandom(int numberOfNodes)
          Creates a new ErrorCheckingRandom instance.
 
Method Summary
 java.util.ArrayList getBackends(java.util.ArrayList backends)
          Pickups backends from the given backends arraylist according to the current rule policy.
 java.lang.String getInformation()
          Gives information about the current policy.
 
Methods inherited from class org.objectweb.cjdbc.controller.loadbalancer.policies.errorchecking.ErrorCheckingPolicy
getNumberOfNodes, getPolicy, getXml, setNumberOfNodes, setPolicy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

random

private java.util.Random random
Constructor Detail

ErrorCheckingRandom

public ErrorCheckingRandom(int numberOfNodes)
Creates a new ErrorCheckingRandom instance.

Parameters:
numberOfNodes - number of nodes to use to check for errors on a query
Method Detail

getBackends

public java.util.ArrayList getBackends(java.util.ArrayList backends)
                                throws ErrorCheckingException
Description copied from class: ErrorCheckingPolicy
Pickups backends from the given backends arraylist according to the current rule policy.

Specified by:
getBackends in class ErrorCheckingPolicy
Parameters:
backends - backends to choose from
Returns:
Arraylist of choosen DatabaseBackend
Throws:
ErrorCheckingException - if the rule cannot be applied
See Also:
ErrorCheckingPolicy.getBackends(ArrayList)

getInformation

public java.lang.String getInformation()
Description copied from class: ErrorCheckingPolicy
Gives information about the current policy.

Specified by:
getInformation in class ErrorCheckingPolicy
Returns:
a String value
See Also:
ErrorCheckingPolicy.getInformation()


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.