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

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.loadbalancer.AbstractLoadBalancer
      extended byorg.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2
          extended byorg.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2ec
              extended byorg.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2ec_WRR

public class RAIDb2ec_WRR
extends RAIDb2ec

RAIDb-2 Weighted Round Robin load balancer with error checking.

This load balancer tolerates byzantine failures of databases. The read requests coming from the request manager are sent to multiple backend nodes and the results are compared. Write requests are broadcasted to all backends.

Version:
1.0
Author:
Emmanuel Cecchet, Julie Marguerite

Field Summary
private  java.util.HashMap backends
           
private  int index
           
 
Fields inherited from class org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2ec
backendReadThreads, errorCheckingPolicy, logger, 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
parsingGranularity, raidbLevel, vdb
 
Constructor Summary
RAIDb2ec_WRR(VirtualDatabase vdb, WaitForCompletionPolicy waitForCompletionPolicy, CreateTablePolicy createTablePolicy, ErrorCheckingPolicy errorCheckingPolicy, int nbOfConcurrentReads)
          Creates a new RAIDb-2 weighted round robin with error checking request load balancer.
 
Method Summary
 java.sql.ResultSet execReadRequest(SelectRequest request)
          Performs a read request.
 java.lang.String getInformation()
          Gets information about the request load balancer.
 java.lang.String getRaidb2Xml()
          return xml formatted information about this raidb2 load balancer
 void setWeight(java.lang.String name, int w)
          Associate a weight to a backend identified by its logical name.
 
Methods inherited from class org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2ec
disableBackend, enableBackend, getXmlInformation
 
Methods inherited from class org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2
begin, commit, execReadStoredProcedure, executeRequest, execWriteRequest, execWriteRequestWithKeys, execWriteStoredProcedure, getXmlCreateTable, getXmlWaitPolicy, rollback, waitForAllWritesToComplete, waitForAllWritesToComplete, waitForAllWritesToComplete
 
Methods inherited from class org.objectweb.cjdbc.controller.loadbalancer.AbstractLoadBalancer
getParsingGranularity, getRAIDbLevel, setParsingGranularity, setRAIDbLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

backends

private java.util.HashMap backends

index

private int index
Constructor Detail

RAIDb2ec_WRR

public RAIDb2ec_WRR(VirtualDatabase vdb,
                    WaitForCompletionPolicy waitForCompletionPolicy,
                    CreateTablePolicy createTablePolicy,
                    ErrorCheckingPolicy errorCheckingPolicy,
                    int nbOfConcurrentReads)
             throws java.sql.SQLException
Creates a new RAIDb-2 weighted round robin with error checking 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
errorCheckingPolicy - Policy to apply for error checking.
nbOfConcurrentReads - Number of concurrent reads allowed
Throws:
java.sql.SQLException - if an error occurs
Method Detail

execReadRequest

public java.sql.ResultSet execReadRequest(SelectRequest request)
                                   throws java.sql.SQLException
Performs a read request. It is up to the implementation to choose to which backend node(s) this request should be sent.

Specified by:
execReadRequest in class RAIDb2
Parameters:
request - an SelectRequest
Returns:
the corresponding java.sql.ResultSet
Throws:
java.sql.SQLException - if an error occurs
See Also:
RAIDb2.executeRequest(SelectRequest, DatabaseBackend)

setWeight

public void setWeight(java.lang.String name,
                      int w)
               throws java.sql.SQLException
Description copied from class: AbstractLoadBalancer
Associate a weight to a backend identified by its logical name.

Overrides:
setWeight in class AbstractLoadBalancer
Parameters:
name - the backend name
w - the weight
Throws:
java.sql.SQLException - if an error occurs
See Also:
AbstractLoadBalancer.setWeight(String, int)

getInformation

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

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:
RAIDb1.getRaidb1Xml()


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