|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.cjdbc.controller.scheduler.AbstractScheduler
org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticTransactionLevelScheduler
This scheduler provides transaction level scheduling for RAIDb-1 controllers. Each write takes a lock on the table it affects. All following writes are blocked until the transaction of the first write completes. This scheduler automatically detects simple deadlocks and rollbacks the transaction inducing the deadlock. Note that transitive deadlocks (involving more than 2 tables are not detected).
| Field Summary | |
private long |
requestId
|
private SchedulerDatabaseSchema |
schedulerDatabaseSchema
|
| Fields inherited from class org.objectweb.cjdbc.controller.scheduler.AbstractScheduler |
logger, parsingGranularity, raidbLevel |
| Fields inherited from interface org.objectweb.cjdbc.common.xml.XmlComponent |
DOCTYPE_DB, XML_VERSION |
| Constructor Summary | |
RAIDb1OptimisticTransactionLevelScheduler()
Creates a new Optimistic Transaction Level Scheduler |
|
| Method Summary | |
private void |
acquireLockAndSetRequestId(AbstractWriteRequest request,
TransactionExclusiveLock tableLock)
|
protected void |
commitTransaction(long transactionId)
Commit a transaction given its id. |
java.lang.String |
getXmlImpl()
|
void |
mergeDatabaseSchema(DatabaseSchema dbs)
Merge the given DatabaseSchema with the current one. |
void |
notifyWriteCompleted(AbstractWriteRequest request)
Notify the completion of a write statement. |
void |
readCompletedNotify(SelectRequest request)
Notify the completion of a read statement. |
private void |
releaseLocks(long transactionId)
Release all locks we may own on tables. |
protected void |
rollbackTransaction(long transactionId)
Rollback a transaction given its id. |
void |
scheduleNonSuspendedWriteRequest(AbstractWriteRequest request)
Additionally to scheduling the request, this method replaces the SQL Date macros such as now() with the current date. |
void |
scheduleReadRequest(SelectRequest request)
Additionally to scheduling the request, this method replaces the SQL Date macros such as now() with the current date. |
void |
setDatabaseSchema(DatabaseSchema dbs)
Sets the DatabaseSchema of the current virtual database.
|
| Methods inherited from class org.objectweb.cjdbc.controller.scheduler.AbstractScheduler |
begin, beginCompleted, commit, commitCompleted, getNumberRead, getNumberWrite, getParsingGranularity, getPendingTransactions, getPendingWrites, getRAIDbLevel, getSchedulerData, getXml, hasSQLMacros, initializeTransactionId, isSuspendedTransactions, isSuspendedWrites, readCompleted, resumeNewTransactions, resumeWrites, rollback, rollbackCompleted, scheduleWriteRequest, setParsingGranularity, setRAIDbLevel, suspendNewTransactionsForCheckpoint, suspendWrites, writeCompleted |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private long requestId
private SchedulerDatabaseSchema schedulerDatabaseSchema
| Constructor Detail |
public RAIDb1OptimisticTransactionLevelScheduler()
| Method Detail |
public 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
setDatabaseSchema in class AbstractSchedulerdbs - a DatabaseSchema valueSchedulerDatabaseSchemapublic void mergeDatabaseSchema(DatabaseSchema dbs)
DatabaseSchema with the current one.
mergeDatabaseSchema in class AbstractSchedulerdbs - a DatabaseSchema valueSchedulerDatabaseSchema
public final void scheduleReadRequest(SelectRequest request)
throws java.sql.SQLException
scheduleReadRequest in class AbstractSchedulerrequest - Select request to schedule (SQL macros are already handled
if needed)
java.sql.SQLException - if a timeout occursAbstractScheduler.scheduleReadRequest(SelectRequest)public final void readCompletedNotify(SelectRequest request)
AbstractScheduler
readCompletedNotify in class AbstractSchedulerrequest - the completed requestAbstractScheduler.readCompletedNotify(SelectRequest)
public void scheduleNonSuspendedWriteRequest(AbstractWriteRequest request)
throws java.sql.SQLException,
RollbackException
scheduleNonSuspendedWriteRequest in class AbstractSchedulerrequest - Write request to schedule (SQL macros are already handled if
needed)
RollbackException - if the transaction must be rollbacked
java.sql.SQLException - if a timeout occursAbstractScheduler.scheduleWriteRequest(AbstractWriteRequest)
private void acquireLockAndSetRequestId(AbstractWriteRequest request,
TransactionExclusiveLock tableLock)
throws java.sql.SQLException
java.sql.SQLExceptionpublic final void notifyWriteCompleted(AbstractWriteRequest request)
AbstractScheduler
notifyWriteCompleted in class AbstractSchedulerrequest - the completed requestAbstractScheduler.notifyWriteCompleted(AbstractWriteRequest)protected final void commitTransaction(long transactionId)
AbstractScheduler
commitTransaction in class AbstractSchedulertransactionId - the transaction idAbstractScheduler.commitTransaction(long)protected final void rollbackTransaction(long transactionId)
AbstractScheduler
rollbackTransaction in class AbstractSchedulertransactionId - the transaction idAbstractScheduler.rollbackTransaction(long)private void releaseLocks(long transactionId)
transactionId - id of the transaction that releases the lockspublic java.lang.String getXmlImpl()
getXmlImpl in class AbstractSchedulerAbstractScheduler.getXmlImpl()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||