|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.cjdbc.controller.scheduler.AbstractScheduler
The Request Scheduler should schedule the request according to a given policy.
The requests comes from the Request Controller and are sent later to the next ccontroller omponents (cache and load balancer).
Field Summary | |
private java.lang.Object |
endOfCurrentTransactions
|
private java.lang.Object |
endOfCurrentWrites
|
protected static Trace |
logger
|
private int |
numberRead
|
private int |
numberWrite
|
protected int |
parsingGranularity
|
private int |
pendingTransactions
|
private int |
pendingWrites
|
protected int |
raidbLevel
|
private int |
sid
|
private boolean |
suspendedTransactions
|
private boolean |
suspendedWrites
|
private long |
tid
|
private java.lang.Object |
transactionSync
|
private java.lang.Object |
writesSync
|
Fields inherited from interface org.objectweb.cjdbc.common.xml.XmlComponent |
DOCTYPE_CONTROLLER, DOCTYPE_DB, XML_VERSION |
Constructor Summary | |
AbstractScheduler(int raidbLevel,
int parsingGranularity)
Default scheduler to assign scheduler RAIDb level, needed granularity and SQL macro handling (on the fly instanciation of NOW(), RAND(), ...). |
Method Summary | |
long |
begin(TransactionMarkerMetaData tm)
Begin a new transaction and return the corresponding transaction identifier. |
void |
beginCompleted(long transactionId)
Notify the completion of a begin command. |
void |
commit(TransactionMarkerMetaData tm)
Commit a transaction. |
void |
commitCompleted(long transactionId)
Notify the completion of a commit command. |
protected abstract void |
commitTransaction(long transactionId)
Commit a transaction given its id. |
int |
getNumberRead()
|
int |
getNumberWrite()
|
int |
getParsingGranularity()
Get the needed query parsing granularity. |
int |
getPendingTransactions()
|
int |
getPendingWrites()
Returns the number of pending writes. |
int |
getRAIDbLevel()
Returns the RAIDbLevel. |
java.lang.String[] |
getSchedulerData()
Returns live information on the scheduler |
java.lang.String |
getXml()
Get information about the Request Scheduler in xml format |
protected abstract java.lang.String |
getXmlImpl()
|
int |
incrementSavepointId()
Increments the savepoint id for un-named savepoints |
void |
initializeTransactionId(long transactionId)
Initialize the transaction id with the given value (usually retrieved from the recovery log). |
boolean |
isSuspendedTransactions()
|
boolean |
isSuspendedWrites()
|
void |
mergeDatabaseSchema(DatabaseSchema dbs)
Merge the given DatabaseSchema with the current one. |
abstract void |
notifyStoredProcedureCompleted(StoredProcedure proc)
Notify the completion of a stored procedure. |
abstract void |
notifyWriteCompleted(AbstractWriteRequest request)
Notify the completion of a write statement. |
void |
readCompleted(SelectRequest request)
Notify the completion of a read statement. |
abstract void |
readCompletedNotify(SelectRequest request)
Notify the completion of a read statement. |
void |
releaseSavepoint(TransactionMarkerMetaData tm,
java.lang.String name)
Release a savepoint. |
protected abstract void |
releaseSavepointTransaction(long transactionId,
java.lang.String name)
Release a savepoint given its name from a transaction given its id. |
void |
resumeNewTransactions()
Resume new transactions that were suspended by suspendNewTransactionsForCheckpoint(). |
void |
resumeWrites()
Resume the execution of write queries that were suspended by suspendWrites(). |
void |
rollback(TransactionMarkerMetaData tm)
Rollback a transaction. |
void |
rollback(TransactionMarkerMetaData tm,
java.lang.String savepointName)
Rollback a transaction to a savepoint. |
void |
rollbackCompleted(long transactionId)
Notify the completion of a rollback command. |
protected abstract void |
rollbackTransaction(long transactionId)
Rollback a transaction given its id. |
protected abstract void |
rollbackTransaction(long transactionId,
java.lang.String savepointName)
Rollback a transaction given its id to a savepoint given its name. |
void |
savepointCompleted(long transactionId)
Notify the conpletion of a savepoint action. |
abstract void |
scheduleNonSuspendedStoredProcedure(StoredProcedure proc)
Schedule a write request (implementation specific). |
abstract void |
scheduleNonSuspendedWriteRequest(AbstractWriteRequest request)
Schedule a write request (implementation specific). |
abstract void |
scheduleReadRequest(SelectRequest request)
Schedule a read request (implementation specific). |
void |
scheduleStoredProcedure(StoredProcedure proc)
Schedule a write request. |
void |
scheduleWriteRequest(AbstractWriteRequest request)
Schedule a write request. |
void |
setDatabaseSchema(DatabaseSchema dbs)
Sets the DatabaseSchema of the current virtual database.
|
void |
setParsingGranularity(int parsingGranularity)
Set the needed query parsing granularity. |
void |
setRAIDbLevel(int raidbLevel)
Sets the RAIDb level. |
int |
setSavepoint(TransactionMarkerMetaData tm)
Set an unnamed savepoint. |
void |
setSavepoint(TransactionMarkerMetaData tm,
java.lang.String name)
Set a named savepoint. |
protected abstract void |
setSavepointTransaction(long transactionId,
java.lang.String name)
Set a savepoint given its name to a transaction given its id. |
void |
storedProcedureCompleted(StoredProcedure proc)
Notify the completion of a stored procedure. |
void |
suspendNewTransactionsForCheckpoint()
Suspend all calls to begin() until all current transactions are finished in order to store a checkpoint. |
private void |
suspendWriteIfNeeded(AbstractRequest request)
Suspend write requests if suspendedWrites is active. |
void |
suspendWrites()
Suspend all write queries. |
void |
writeCompleted(AbstractWriteRequest request)
Notify the completion of a write statement. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int raidbLevel
protected int parsingGranularity
private long tid
private int sid
private boolean suspendedTransactions
private int pendingTransactions
private java.lang.Object transactionSync
private java.lang.Object endOfCurrentTransactions
private boolean suspendedWrites
private int pendingWrites
private java.lang.Object writesSync
private java.lang.Object endOfCurrentWrites
protected static Trace logger
private int numberRead
private int numberWrite
Constructor Detail |
public AbstractScheduler(int raidbLevel, int parsingGranularity)
raidbLevel
- RAIDb level of this schedulerparsingGranularity
- Parsing granularity needed by the schedulerMethod Detail |
public final void initializeTransactionId(long transactionId)
transactionId
- new current transaction identifierpublic final int getParsingGranularity()
public final void setParsingGranularity(int parsingGranularity)
parsingGranularity
- Parsing granularity needed by the schedulerpublic final int getPendingWrites()
public final int getRAIDbLevel()
public final void setRAIDbLevel(int raidbLevel)
raidbLevel
- The RAIDbLevel to setpublic void setDatabaseSchema(DatabaseSchema dbs)
DatabaseSchema
of the current virtual database.
This is only needed by some schedulers that will have to define their own
scheduler schema
dbs
- a DatabaseSchema
valueSchedulerDatabaseSchema
public void mergeDatabaseSchema(DatabaseSchema dbs)
DatabaseSchema
with the current one.
dbs
- a DatabaseSchema
valueSchedulerDatabaseSchema
public int incrementSavepointId()
public abstract void scheduleReadRequest(SelectRequest request) throws java.sql.SQLException
request
- Select request to schedule (SQL macros are already handled
if needed)
java.sql.SQLException
- if a timeout occurspublic abstract void readCompletedNotify(SelectRequest request)
request
- the completed requestpublic final void readCompleted(SelectRequest request)
request
- the completed requestpublic final void scheduleWriteRequest(AbstractWriteRequest request) throws java.sql.SQLException, RollbackException
request
- Write request to schedule
java.sql.SQLException
- if a timeout occurs
RollbackException
- if an error occursscheduleNonSuspendedWriteRequest(AbstractWriteRequest)
public abstract void scheduleNonSuspendedWriteRequest(AbstractWriteRequest request) throws java.sql.SQLException, RollbackException
request
- Write request to schedule (SQL macros are already handled if
needed)
java.sql.SQLException
- if a timeout occurs
RollbackException
- if the transaction must be rollbackedpublic final void writeCompleted(AbstractWriteRequest request)
This method updates the number of pending writes and calls the implementation specific notifyWriteCompleted function.
Finally, the suspendWrites() function is notified if needed.
request
- the completed requestnotifyWriteCompleted(AbstractWriteRequest)
,
suspendWrites()
public abstract void notifyWriteCompleted(AbstractWriteRequest request)
request
- the completed requestwriteCompleted(AbstractWriteRequest)
public final void scheduleStoredProcedure(StoredProcedure proc) throws java.sql.SQLException, RollbackException
proc
- Stored procedure to schedule
java.sql.SQLException
- if a timeout occurs
RollbackException
- if an error occursscheduleNonSuspendedStoredProcedure(StoredProcedure)
public abstract void scheduleNonSuspendedStoredProcedure(StoredProcedure proc) throws java.sql.SQLException, RollbackException
proc
- Stored procedure to schedule
java.sql.SQLException
- if a timeout occurs
RollbackException
- if the transaction must be rollbackedpublic final void storedProcedureCompleted(StoredProcedure proc)
This method updates the number of pending writes and calls the implementation specific notifyStoredProcedureCompleted function.
Finally, the suspendWrites() function is notified if needed.
proc
- the completed stored procedurenotifyStoredProcedureCompleted(StoredProcedure)
,
suspendWrites()
public abstract void notifyStoredProcedureCompleted(StoredProcedure proc)
proc
- the completed stored procedurestoredProcedureCompleted(StoredProcedure)
private void suspendWriteIfNeeded(AbstractRequest request) throws java.sql.SQLException
request
- the request to suspend (a write request or a stored
procedure)
java.sql.SQLException
- if the request timeout has expiredpublic final long begin(TransactionMarkerMetaData tm) throws java.sql.SQLException
tm
- The transaction marker metadata
java.sql.SQLException
- if an error occurspublic final void beginCompleted(long transactionId)
transactionId
- of the completed beginpublic final void commit(TransactionMarkerMetaData tm) throws java.sql.SQLException
Calls the implementation specific commitTransaction()
tm
- The transaction marker metadata
java.sql.SQLException
- if an error occurscommitTransaction(long)
protected abstract void commitTransaction(long transactionId)
transactionId
- the transaction idpublic final void commitCompleted(long transactionId)
transactionId
- of the completed commitpublic final void rollback(TransactionMarkerMetaData tm) throws java.sql.SQLException
Calls the implementation specific rollbackTransaction()
tm
- The transaction marker metadata
java.sql.SQLException
- if an error occursrollbackTransaction(long)
public final void rollback(TransactionMarkerMetaData tm, java.lang.String savepointName) throws java.sql.SQLException
Calls the implementation specific rollbackTransaction()
tm
- transaction marker metadatasavepointName
- name of the savepoint
java.sql.SQLException
- if an error occursprotected abstract void rollbackTransaction(long transactionId)
transactionId
- the transaction idprotected abstract void rollbackTransaction(long transactionId, java.lang.String savepointName)
transactionId
- the transaction idsavepointName
- the name of the savepointpublic final void rollbackCompleted(long transactionId)
transactionId
- of the rollback commitpublic final int setSavepoint(TransactionMarkerMetaData tm) throws java.sql.SQLException
Calls the implementation specific setSavepointTransaction()
tm
- transaction marker metadata
java.sql.SQLException
- if an error occurspublic final void setSavepoint(TransactionMarkerMetaData tm, java.lang.String name) throws java.sql.SQLException
Calls the implementation specific setSavepointTransaction()
tm
- transaction marker metadataname
- name of the savepoint
java.sql.SQLException
- if an error occursprotected abstract void setSavepointTransaction(long transactionId, java.lang.String name)
transactionId
- the transaction idname
- the name of the savepointpublic final void releaseSavepoint(TransactionMarkerMetaData tm, java.lang.String name) throws java.sql.SQLException
Calls the implementation specific releaseSavepointTransaction()
tm
- transaction marker metadataname
- name of the savepoint
java.sql.SQLException
- if an error occursprotected abstract void releaseSavepointTransaction(long transactionId, java.lang.String name)
transactionId
- the transaction idname
- the name of the savepointpublic final void savepointCompleted(long transactionId)
transactionId
- the transaction identifierpublic final void suspendNewTransactionsForCheckpoint() throws java.sql.SQLException
New transactions remain suspended until resumeNewTransactions() is called.
java.sql.SQLException
- if an error occursresumeNewTransactions()
public final void resumeNewTransactions()
suspendNewTransactionsForCheckpoint()
public void suspendWrites() throws java.sql.SQLException
Writes execution is resumed by calling resumeWrites()
java.sql.SQLException
- if an error occursresumeWrites()
public void resumeWrites()
suspendWrites()
protected abstract java.lang.String getXmlImpl()
public java.lang.String getXml()
getXml
in interface XmlComponent
String
containing information in xmlpublic java.lang.String[] getSchedulerData()
public int getNumberRead()
public int getNumberWrite()
public int getPendingTransactions()
public boolean isSuspendedTransactions()
public boolean isSuspendedWrites()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |