org.objectweb.cjdbc.driver.connectpolicy
Class PreferredListConnectPolicy

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

public class PreferredListConnectPolicy
extends AbstractControllerConnectPolicy

This class defines a PreferredListConnectPolicy

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
private  java.util.ArrayList deadPreferredControllers
           
private  int index
           
private  java.util.ArrayList preferredControllers
           
 
Fields inherited from class org.objectweb.cjdbc.driver.connectpolicy.AbstractControllerConnectPolicy
controllerList, debugLevel, suspectedControllers
 
Constructor Summary
PreferredListConnectPolicy(ControllerInfo[] controllerList, long retryIntervalInMs, java.lang.String preferredControllerList, int debugLevel)
          Creates a new PreferredListConnectPolicy object
 
Method Summary
 ControllerInfo getController()
          Get a controller using the implementation specific policy
 void removeControllerFromSuspectList(ControllerInfo controller)
          Remove the specified controller from the list of suspect controllers
 void suspectControllerOfFailure(ControllerInfo controllerInfo)
          Add the controller to the list of suspects.
 
Methods inherited from class org.objectweb.cjdbc.driver.connectpolicy.AbstractControllerConnectPolicy
finalize, getControllerList, getSuspectedControllers, isSuspectedOfFailure, setControllerList
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

private int index

preferredControllers

private java.util.ArrayList preferredControllers

deadPreferredControllers

private java.util.ArrayList deadPreferredControllers
Constructor Detail

PreferredListConnectPolicy

public PreferredListConnectPolicy(ControllerInfo[] controllerList,
                                  long retryIntervalInMs,
                                  java.lang.String preferredControllerList,
                                  int debugLevel)
Creates a new PreferredListConnectPolicy 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
preferredControllerList - comma separated list of preferred controllers
debugLevel - the debug level to use
See Also:
CjdbcUrl.DEBUG_LEVEL_OFF
Method Detail

removeControllerFromSuspectList

public void removeControllerFromSuspectList(ControllerInfo controller)
Description copied from class: AbstractControllerConnectPolicy
Remove the specified controller from the list of suspect controllers

Overrides:
removeControllerFromSuspectList in class AbstractControllerConnectPolicy
Parameters:
controller - the controller to remove from the list
See Also:
AbstractControllerConnectPolicy.removeControllerFromSuspectList(org.objectweb.cjdbc.driver.ControllerInfo)

suspectControllerOfFailure

public void suspectControllerOfFailure(ControllerInfo controllerInfo)
Description copied from class: AbstractControllerConnectPolicy
Add the controller to the list of suspects.

Overrides:
suspectControllerOfFailure in class AbstractControllerConnectPolicy
Parameters:
controllerInfo - the controller suspected of failure
See Also:
AbstractControllerConnectPolicy.suspectControllerOfFailure(org.objectweb.cjdbc.driver.ControllerInfo)

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.