org.objectweb.cjdbc.controller.loadbalancer.paralleldb
Class ParallelDB_RR

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.paralleldb.ParallelDB
                  extended byorg.objectweb.cjdbc.controller.loadbalancer.paralleldb.ParallelDB_RR
All Implemented Interfaces:
AbstractLoadBalancerMBean, javax.management.DynamicMBean, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, XmlComponent

public class ParallelDB_RR
extends ParallelDB

This class defines a ParallelDB_RR load balancer. This load balancer performs simple round-robin for read and write queries execution.

Version:
1.0
Author:
Emmanuel Cecchet

Nested Class Summary
 
Nested classes inherited from class javax.management.StandardMBean
 
Field Summary
private  int index
           
 
Fields inherited from class org.objectweb.cjdbc.controller.loadbalancer.paralleldb.ParallelDB
 
Fields inherited from class org.objectweb.cjdbc.controller.loadbalancer.AbstractLoadBalancer
logger, 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
ParallelDB_RR(VirtualDatabase vdb)
          Creates a new ParallelDB_RR object
 
Method Summary
 DatabaseBackend chooseBackendForReadRequest(AbstractRequest request)
          Choose a backend using a round-robin algorithm for read request execution.
 DatabaseBackend chooseBackendForWriteRequest(AbstractWriteRequest request)
          Choose a backend using a round-robin algorithm for write request execution.
 java.lang.String getInformation()
          Get information about the Request Load Balancer
 java.lang.String getParallelDBXml()
          Return the XML tags of the ParallelDB load balancer implementation.
 
Methods inherited from class org.objectweb.cjdbc.controller.loadbalancer.paralleldb.ParallelDB
begin, commit, disableBackend, enableBackend, execReadOnlyReadStoredProcedure, execReadRequest, execReadStoredProcedure, execWriteRequest, execWriteRequestWithKeys, execWriteStoredProcedure, getNumberOfEnabledBackends, getXmlImpl, releaseSavepoint, rollback, rollback, setSavepoint
 
Methods inherited from class org.objectweb.cjdbc.controller.loadbalancer.AbstractLoadBalancer
executeReadStoredProcedureOnBackend, executeSelectRequestOnBackend, executeUpdateRequestOnBackend, executeUpdateRequestOnBackendWithKeys, executeWriteStoredProcedureOnBackend, getAssociatedString, getConnectionAndBeginTransaction, 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

index

private int index
Constructor Detail

ParallelDB_RR

public ParallelDB_RR(VirtualDatabase vdb)
              throws java.lang.Exception
Creates a new ParallelDB_RR object

Parameters:
vdb - the virtual database this load balancer belongs to.
Throws:
java.lang.Exception - if an error occurs
Method Detail

chooseBackendForReadRequest

public DatabaseBackend chooseBackendForReadRequest(AbstractRequest request)
                                            throws java.sql.SQLException
Choose a backend using a round-robin algorithm for read request execution.

Specified by:
chooseBackendForReadRequest in class ParallelDB
Parameters:
request - request to execute
Returns:
the chosen backend
Throws:
java.sql.SQLException - if an error occurs

chooseBackendForWriteRequest

public DatabaseBackend chooseBackendForWriteRequest(AbstractWriteRequest request)
                                             throws java.sql.SQLException
Choose a backend using a round-robin algorithm for write request execution.

Specified by:
chooseBackendForWriteRequest in class ParallelDB
Parameters:
request - request to execute
Returns:
the chosen backend
Throws:
java.sql.SQLException - if an error occurs

getInformation

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

Specified by:
getInformation in interface AbstractLoadBalancerMBean
Specified by:
getInformation in class AbstractLoadBalancer
Returns:
String containing information
See Also:
AbstractLoadBalancer.getInformation()

getParallelDBXml

public java.lang.String getParallelDBXml()
Description copied from class: ParallelDB
Return the XML tags of the ParallelDB load balancer implementation.

Specified by:
getParallelDBXml in class ParallelDB
Returns:
content of ParallelDB xml
See Also:
ParallelDB.getParallelDBXml()


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