|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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 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_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()
|
protected boolean |
hasSQLMacros(AbstractRequest request)
Returns true if the query contains SQL macros. |
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 |
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 |
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 |
rollbackCompleted(long transactionId)
Notify the completion of a rollback command. |
protected abstract void |
rollbackTransaction(long transactionId)
Rollback a transaction given its id. |
abstract void |
scheduleNonSuspendedWriteRequest(AbstractWriteRequest request)
Schedule a write request (implementation specific). |
abstract void |
scheduleReadRequest(SelectRequest request)
Schedule a read request (implementation specific). |
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. |
void |
suspendNewTransactionsForCheckpoint()
Suspend all calls to begin() until all current transactions are finished in order to store a checkpoint. |
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 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 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)
protected boolean hasSQLMacros(AbstractRequest request)
request
- the request to check
public 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 id
RemoteException
- if an error occurspublic 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)
protected abstract void rollbackTransaction(long transactionId)
transactionId
- the transaction id
RemoteException
- if an error occurspublic final void rollbackCompleted(long transactionId)
transactionId
- of the rollback commitpublic 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 |