org.objectweb.cjdbc.driver.connectpolicy
Class RoundRobinConnectPolicy

java.lang.Object
  extended byorg.objectweb.cjdbc.driver.connectpolicy.AbstractControllerConnectPolicy
      extended byorg.objectweb.cjdbc.driver.connectpolicy.RoundRobinConnectPolicy

public class RoundRobinConnectPolicy
extends AbstractControllerConnectPolicy

This class defines a RoundRobinConnectPolicy used when the C-JDBC URL has the following form: jdbc:cjdbc://node1,node2,node3/myDB?preferredController=roundRobin

Round robin starts with the first node in URL.

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
private  int index
           
 
Fields inherited from class org.objectweb.cjdbc.driver.connectpolicy.AbstractControllerConnectPolicy
controllerList, debugLevel, suspectedControllers
 
Constructor Summary
RoundRobinConnectPolicy(ControllerInfo[] controllerList, long retryIntervalInMs, int debugLevel)
          Creates a new RandomConnectPolicy object
 
Method Summary
 ControllerInfo getController()
          Get a controller using the implementation specific policy
 
Methods inherited from class org.objectweb.cjdbc.driver.connectpolicy.AbstractControllerConnectPolicy
finalize, getControllerList, getSuspectedControllers, isSuspectedOfFailure, removeControllerFromSuspectList, setControllerList, suspectControllerOfFailure
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

private int index
Constructor Detail

RoundRobinConnectPolicy

public RoundRobinConnectPolicy(ControllerInfo[] controllerList,
                               long retryIntervalInMs,
                               int debugLevel)
Creates a new RandomConnectPolicy object

Parameters:
controllerList - list of controller from C-JDBC url
retryIntervalInMs - Interval in milliseconds before retrying to re-connect to a controller that has failed
debugLevel - the debug level to use
See Also:
CjdbcUrl.DEBUG_LEVEL_OFF
Method Detail

getController

public ControllerInfo getController()
                             throws NoMoreControllerException
Description copied from class: AbstractControllerConnectPolicy
Get a controller using the implementation specific policy

Specified by:
getController in class AbstractControllerConnectPolicy
Returns:
ControllerInfo of the selected controller
Throws:
NoMoreControllerException - if no controller in the controller list is reachable
See Also:
AbstractControllerConnectPolicy.getController()


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