org.objectweb.cjdbc.controller.loadbalancer.raidb2
Class RAIDb2ec

java.lang.Object
  extended byjavax.management.StandardMBean
      extended byorg.objectweb.cjdbc.controller.jmx.AbstractStandardMBean
          extended byorg.objectweb.cjdbc.controller.loadbalancer.AbstractLoadBalancer
              extended byorg.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2
                  extended byorg.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2ec
All Implemented Interfaces:
AbstractLoadBalancerMBean, javax.management.DynamicMBean, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, XmlComponent
Direct Known Subclasses:
RAIDb2ec_RR, RAIDb2ec_WRR

public abstract class RAIDb2ec
extends RAIDb2

RAIDb-2ec load balancer.

This class is an abstract call because the read requests coming from the request manager are NOT treated here but in the subclasses. This class deals with backend enable/disable for backendReadThreads creation/termination.

Version:
1.0
Author:
Emmanuel Cecchet

Nested Class Summary
 
Nested classes inherited from class javax.management.StandardMBean
 
Field Summary
protected  java.util.ArrayList backendReadThreads
           
protected  ErrorCheckingPolicy errorCheckingPolicy
           
protected static Trace logger
           
protected  int nbOfConcurrentReads
           
 
Fields inherited from class org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2
backendBlockingThreads, backendBlockingThreadsRWLock, backendNonBlockingThreads, backendNonBlockingThreadsRWLock, createTablePolicy, waitForCompletionPolicy
 
Fields inherited from class org.objectweb.cjdbc.controller.loadbalancer.AbstractLoadBalancer
macroHandler, parsingGranularity, raidbLevel, totalOrderQueue, vdb
 
Fields inherited from class org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean
 
Fields inherited from class javax.management.StandardMBean
 
Fields inherited from interface org.objectweb.cjdbc.common.xml.XmlComponent
DOCTYPE_CONTROLLER, DOCTYPE_DB, XML_VERSION
 
Constructor Summary
RAIDb2ec(VirtualDatabase vdb, WaitForCompletionPolicy waitForCompletionPolicy, CreateTablePolicy createTablePolicy, ErrorCheckingPolicy errorCheckingPolicy, int nbOfConcurrentReads)
          Creates a new RAIDb-1 Round Robin request load balancer.
 
Method Summary
 void disableBackend(DatabaseBackend db)
          Disables a backend that was previously enabled.
 void enableBackend(DatabaseBackend db, boolean writeEnabled)
          Enables a backend that was previously disabled.
 java.lang.String getXmlImpl()
          Get information about the Request Load Balancer in xml
 
Methods inherited from class org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2
begin, commit, execReadRequest, execReadStoredProcedure, executeRequestOnBackend, executeStoredProcedureOnBackend, execWriteRequest, execWriteRequestWithKeys, execWriteStoredProcedure, getNumberOfEnabledBackends, getRaidb2Xml, releaseSavepoint, rollback, rollback, setSavepoint, waitForAllWritesToComplete, waitForAllWritesToComplete, waitForAllWritesToComplete
 
Methods inherited from class org.objectweb.cjdbc.controller.loadbalancer.AbstractLoadBalancer
execReadOnlyReadStoredProcedure, executeReadStoredProcedureOnBackend, executeSelectRequestOnBackend, executeUpdateRequestOnBackend, executeUpdateRequestOnBackendWithKeys, executeWriteStoredProcedureOnBackend, getAssociatedString, getConnectionAndBeginTransaction, getInformation, getParsingGranularity, getRAIDbLevel, getXml, handleMacros, removeHeadFromAndNotifyTotalOrderQueue, setMacroHandler, setParsingGranularity, setRAIDbLevel, setWeight, waitForTotalOrder
 
Methods inherited from class org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean
addNotificationListener, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getNotificationInfo, getParameterName, getParameterName, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class javax.management.StandardMBean
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, invoke, setAttribute, setAttributes, setImplementation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

backendReadThreads

protected java.util.ArrayList backendReadThreads

nbOfConcurrentReads

protected int nbOfConcurrentReads

errorCheckingPolicy

protected ErrorCheckingPolicy errorCheckingPolicy

logger

protected static Trace logger
Constructor Detail

RAIDb2ec

public RAIDb2ec(VirtualDatabase vdb,
                WaitForCompletionPolicy waitForCompletionPolicy,
                CreateTablePolicy createTablePolicy,
                ErrorCheckingPolicy errorCheckingPolicy,
                int nbOfConcurrentReads)
         throws java.lang.Exception
Creates a new RAIDb-1 Round Robin request load balancer. A new backend worker thread is created for each backend.

Parameters:
vdb - the virtual database this load balancer belongs to.
waitForCompletionPolicy - how many backends must complete before returning the result?
createTablePolicy - the policy defining how 'create table' statements should be handled
errorCheckingPolicy - policy to apply for error checking.
nbOfConcurrentReads - number of concurrent reads allowed
Throws:
java.lang.Exception - if an error occurs
Method Detail

enableBackend

public void enableBackend(DatabaseBackend db,
                          boolean writeEnabled)
                   throws java.sql.SQLException
Enables a backend that was previously disabled.

Ask the corresponding connection manager to initialize the connections if needed.

No sanity checks are performed by this function.

Overrides:
enableBackend in class RAIDb2
Parameters:
db - the database backend to enable
writeEnabled - True if the backend must be enabled for writes
Throws:
java.sql.SQLException - if an error occurs

disableBackend

public void disableBackend(DatabaseBackend db)
                    throws java.sql.SQLException
Disables a backend that was previously enabled.

Ask the corresponding connection manager to finalize the connections if needed.

No sanity checks are performed by this function.

Overrides:
disableBackend in class RAIDb2
Parameters:
db - the database backend to disable
Throws:
java.sql.SQLException - if an error occurs

getXmlImpl

public java.lang.String getXmlImpl()
Description copied from class: AbstractLoadBalancer
Get information about the Request Load Balancer in xml

Overrides:
getXmlImpl in class RAIDb2
See Also:
AbstractLoadBalancer.getXmlImpl()


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