|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.cjdbc.controller.loadbalancer.AbstractLoadBalancer
org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2
RAIDb-2 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. Transaction management and write requests are broadcasted to all backends owning the written table.
| Field Summary | |
protected java.util.ArrayList |
backendBlockingThreads
|
protected ReadPrioritaryFIFOWriteLock |
backendBlockingThreadsRWLock
|
protected java.util.ArrayList |
backendNonBlockingThreads
|
protected ReadPrioritaryFIFOWriteLock |
backendNonBlockingThreadsRWLock
|
protected CreateTablePolicy |
createTablePolicy
|
private int |
execWriteRequestResult
|
private java.sql.ResultSet |
execWriteRequestWithKeysResult
|
protected static Trace |
logger
|
protected WaitForCompletionPolicy |
waitForCompletionPolicy
|
| Fields inherited from class org.objectweb.cjdbc.controller.loadbalancer.AbstractLoadBalancer |
parsingGranularity, raidbLevel, vdb |
| Constructor Summary | |
RAIDb2(VirtualDatabase vdb,
WaitForCompletionPolicy waitForCompletionPolicy,
CreateTablePolicy createTablePolicy)
Creates a new RAIDb-1 Round Robin request load balancer. |
|
| Method Summary | |
void |
begin(TransactionMarkerMetaData tm)
Begins a new transaction. |
private AbstractTask |
callStoredProcedure(StoredProcedure proc,
boolean isRead)
Post the stored procedure call in the threads task list. |
void |
commit(TransactionMarkerMetaData tm)
Commits a transaction. |
void |
disableBackend(DatabaseBackend db)
Disables a backend that was previously enabled. |
void |
enableBackend(DatabaseBackend db)
Enables a Backend that was previously disabled. |
abstract java.sql.ResultSet |
execReadRequest(SelectRequest request)
Implementation specific load balanced read execution. |
java.sql.ResultSet |
execReadStoredProcedure(StoredProcedure proc)
Call a stored procedure that returns a ResultSet. |
protected java.sql.ResultSet |
executeRequest(SelectRequest request,
DatabaseBackend backend)
Execute a read request on the selected backend. |
int |
execWriteRequest(AbstractWriteRequest request)
Performs a write request. |
private void |
execWriteRequest(AbstractWriteRequest request,
boolean useKeys)
Common code for execWriteRequest(AbstractWriteRequest) and execWriteRequestWithKeys(AbstractWriteRequest). |
java.sql.ResultSet |
execWriteRequestWithKeys(AbstractWriteRequest request)
Perform a write request and return the auto generated keys. |
int |
execWriteStoredProcedure(StoredProcedure proc)
Call a stored procedure that performs an update. |
private int |
getNbToWait(int nbOfThreads)
Returns the number of nodes to wait for according to the defined waitForCompletion policy. |
abstract java.lang.String |
getRaidb2Xml()
return xml formatted information about this raidb2 load balancer |
java.lang.String |
getXmlCreateTable()
get xml information on create table policy |
java.lang.String |
getXmlInformation()
Get information about the Request Load Balancer in xml |
java.lang.String |
getXmlWaitPolicy()
get xml formatted wait policy according to c-jdbc.dtd |
void |
rollback(TransactionMarkerMetaData tm)
Rollbacks a transaction. |
protected void |
waitForAllWritesToComplete(DatabaseBackend backend)
Waits for all writes in the blocking thread queue of the given backend to complete. |
protected void |
waitForAllWritesToComplete(DatabaseBackend backend,
int transactionId)
Waits for all writes of the given transaction in the blocking thread queue of the given backend to complete before being able to complete the transaction. |
protected void |
waitForAllWritesToComplete(int transactionId)
Waits for all writes of the given transaction in the blocking thread queue to complete before being able to complete the transaction. |
| Methods inherited from class org.objectweb.cjdbc.controller.loadbalancer.AbstractLoadBalancer |
getInformation, getParsingGranularity, getRAIDbLevel, setParsingGranularity, setRAIDbLevel, setWeight |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.ArrayList backendBlockingThreads
protected java.util.ArrayList backendNonBlockingThreads
protected ReadPrioritaryFIFOWriteLock backendBlockingThreadsRWLock
protected ReadPrioritaryFIFOWriteLock backendNonBlockingThreadsRWLock
protected WaitForCompletionPolicy waitForCompletionPolicy
protected CreateTablePolicy createTablePolicy
protected static Trace logger
private int execWriteRequestResult
private java.sql.ResultSet execWriteRequestWithKeysResult
| Constructor Detail |
public RAIDb2(VirtualDatabase vdb,
WaitForCompletionPolicy waitForCompletionPolicy,
CreateTablePolicy createTablePolicy)
throws java.sql.SQLException
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
java.sql.SQLException - if an error occurs| Method Detail |
private final int getNbToWait(int nbOfThreads)
waitForCompletion policy.
nbOfThreads - total number of threads
public int execWriteRequest(AbstractWriteRequest request)
throws java.sql.SQLException
execWriteRequest in class AbstractLoadBalancerrequest - an AbstractWriteRequest
java.sql.SQLException - if an error occurs
public java.sql.ResultSet execWriteRequestWithKeys(AbstractWriteRequest request)
throws java.sql.SQLException
execWriteRequestWithKeys in class AbstractLoadBalancerrequest - the request to execute
java.sql.SQLException - if an error occurs
private void execWriteRequest(AbstractWriteRequest request,
boolean useKeys)
throws java.sql.SQLException
request - the request to executeuseKeys - true if this must give an auto generated keys ResultSet
java.sql.SQLException - if an error occurs
public abstract java.sql.ResultSet execReadRequest(SelectRequest request)
throws java.sql.SQLException
execReadRequest in class AbstractLoadBalancerrequest - an SelectRequest
java.sql.ResultSet
java.sql.SQLException - if an error occurs
protected java.sql.ResultSet executeRequest(SelectRequest request,
DatabaseBackend backend)
throws java.sql.SQLException
request - the request to executebackend - the backend that will execute the request
java.sql.SQLException - if an error occurs
public java.sql.ResultSet execReadStoredProcedure(StoredProcedure proc)
throws java.sql.SQLException
AbstractLoadBalancer
execReadStoredProcedure in class AbstractLoadBalancerproc - the stored procedure call
java.sql.ResultSet value
java.sql.SQLException - if an error occursAbstractLoadBalancer.execReadStoredProcedure(org.objectweb.cjdbc.sql.StoredProcedure)
public int execWriteStoredProcedure(StoredProcedure proc)
throws java.sql.SQLException
AbstractLoadBalancer
execWriteStoredProcedure in class AbstractLoadBalancerproc - the stored procedure call
java.sql.SQLException - if an error occursAbstractLoadBalancer.execWriteStoredProcedure(org.objectweb.cjdbc.sql.StoredProcedure)
private AbstractTask callStoredProcedure(StoredProcedure proc,
boolean isRead)
throws java.sql.SQLException
proc - the stored procedure to callisRead - true if the call returns a ResultSet
java.sql.SQLException - if an error occurs
public final void begin(TransactionMarkerMetaData tm)
throws java.sql.SQLException
begin in class AbstractLoadBalancertm - the transaction marker metadata
java.sql.SQLException - if an error occurs
public void commit(TransactionMarkerMetaData tm)
throws java.sql.SQLException
commit in class AbstractLoadBalancertm - the transaction marker metadata
java.sql.SQLException - if an error occurs
public void rollback(TransactionMarkerMetaData tm)
throws java.sql.SQLException
rollback in class AbstractLoadBalancertm - the transaction marker metadata
java.sql.SQLException - if an error occurs
protected void waitForAllWritesToComplete(int transactionId)
throws java.sql.SQLException
java.sql.SQLException
protected void waitForAllWritesToComplete(DatabaseBackend backend,
int transactionId)
throws java.sql.SQLException
java.sql.SQLExceptionexecuteRequest(SelectRequest, DatabaseBackend)
protected void waitForAllWritesToComplete(DatabaseBackend backend)
throws java.sql.SQLException
java.sql.SQLExceptionexecuteRequest(SelectRequest, DatabaseBackend)
public void enableBackend(DatabaseBackend db)
throws java.sql.SQLException
Ask the corresponding connection manager to initialize the connections if needed.
No sanity checks are performed by this function.
enableBackend in class AbstractLoadBalancerdb - The database backend to enable
java.sql.SQLException - if an error occurs
public void disableBackend(DatabaseBackend db)
throws java.sql.SQLException
Ask the corresponding connection manager to finalize the connections if needed.
No sanity checks are performed by this function.
disableBackend in class AbstractLoadBalancerdb - the database backend to disable
java.sql.SQLException - if an error occurspublic java.lang.String getXmlInformation()
AbstractLoadBalancer
getXmlInformation in class AbstractLoadBalancerString containing information, xml formattedAbstractLoadBalancer.getXmlInformation()public java.lang.String getXmlWaitPolicy()
public abstract java.lang.String getRaidb2Xml()
public java.lang.String getXmlCreateTable()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||