org.objectweb.cjdbc.controller.loadbalancer.raidb2
Class RAIDb2_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.raidb2.RAIDb2
                  extended byorg.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2_RR
All Implemented Interfaces:
AbstractLoadBalancerMBean, javax.management.DynamicMBean, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, XmlComponent

public class RAIDb2_RR
extends RAIDb2

RAIDb-2 Round Robin load balancer.

The read requests coming from the request manager are sent in a round robin to the backend nodes. Write requests are broadcasted to all backends.

Version:
1.0
Author:
Emmanuel Cecchet , Julie Marguerite

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.raidb2.RAIDb2
backendBlockingThreads, backendBlockingThreadsRWLock, backendNonBlockingThreads, backendNonBlockingThreadsRWLock, createTablePolicy, logger, 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
RAIDb2_RR(VirtualDatabase vdb, WaitForCompletionPolicy waitForCompletionPolicy, CreateTablePolicy createTablePolicy)
          Creates a new RAIDb-2 Round Robin request load balancer.
 
Method Summary
 ControllerResultSet execReadOnlyReadStoredProcedure(StoredProcedure proc, MetadataCache metadataCache)
          Chooses the node to execute the stored procedure using a round-robin algorithm.
 ControllerResultSet execReadRequest(SelectRequest request, MetadataCache metadataCache)
          Chooses the node to execute the request using a round-robin algorithm.
 java.lang.String getInformation()
          Gets information about the request load balancer.
 java.lang.String getRaidb2Xml()
          return xml formatted information about this raidb2 load balancer
 
Methods inherited from class org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2
begin, commit, disableBackend, enableBackend, execReadStoredProcedure, executeRequestOnBackend, executeStoredProcedureOnBackend, execWriteRequest, execWriteRequestWithKeys, execWriteStoredProcedure, getNumberOfEnabledBackends, getXmlImpl, releaseSavepoint, rollback, rollback, setSavepoint, waitForAllWritesToComplete, waitForAllWritesToComplete, waitForAllWritesToComplete
 
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

RAIDb2_RR

public RAIDb2_RR(VirtualDatabase vdb,
                 WaitForCompletionPolicy waitForCompletionPolicy,
                 CreateTablePolicy createTablePolicy)
          throws java.lang.Exception
Creates a new RAIDb-2 Round Robin request load balancer.

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
Throws:
java.lang.Exception - if an error occurs
Method Detail

execReadRequest

public ControllerResultSet execReadRequest(SelectRequest request,
                                           MetadataCache metadataCache)
                                    throws java.sql.SQLException
Chooses the node to execute the request using a round-robin algorithm. If the next node has not the tables needed to execute the requests, we try the next one and so on until a suitable backend is found.

Specified by:
execReadRequest in class RAIDb2
Parameters:
request - an SelectRequest
metadataCache - cached metadata to use to construct the result set
Returns:
the corresponding java.sql.ResultSet
Throws:
java.sql.SQLException - if an error occurs
See Also:
RAIDb2.execReadRequest(SelectRequest, MetadataCache)

execReadOnlyReadStoredProcedure

public ControllerResultSet execReadOnlyReadStoredProcedure(StoredProcedure proc,
                                                           MetadataCache metadataCache)
                                                    throws java.sql.SQLException
Chooses the node to execute the stored procedure using a round-robin algorithm. If the next node has not the needed stored procedure, we try the next one and so on until a suitable backend is found.

Specified by:
execReadOnlyReadStoredProcedure in class AbstractLoadBalancer
Parameters:
proc - the stored procedure call
metadataCache - MetadataCache (null if none)
Returns:
a ControllerResultSet value
Throws:
java.sql.SQLException - if an error occurs
See Also:
AbstractLoadBalancer.execReadOnlyReadStoredProcedure(StoredProcedure, MetadataCache)

getInformation

public java.lang.String getInformation()
Gets information about the request load balancer.

Specified by:
getInformation in interface AbstractLoadBalancerMBean
Specified by:
getInformation in class AbstractLoadBalancer
Returns:
String containing information

getRaidb2Xml

public java.lang.String getRaidb2Xml()
Description copied from class: RAIDb2
return xml formatted information about this raidb2 load balancer

Specified by:
getRaidb2Xml in class RAIDb2
Returns:
xml formatted string
See Also:
RAIDb2.getRaidb2Xml()


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