クラス org.objectweb.cjdbc.controller.scheduler.AbstractScheduler

org.objectweb.cjdbc.controller.scheduler.AbstractSchedulerに対する継承グラフ

Inheritance graph
[凡例]
すべてのメンバ一覧

説明

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).

作者:
Emmanuel Cecchet
バージョン:
1.0

AbstractScheduler.java50 行で定義されています。

Public メソッド

 AbstractScheduler (int raidbLevel, int parsingGranularity)
final void initializeTransactionId (long transactionId)
final int getParsingGranularity ()
final void setParsingGranularity (int parsingGranularity)
final int getPendingWrites ()
final int getRAIDbLevel ()
final void setRAIDbLevel (int raidbLevel)
void setDatabaseSchema (DatabaseSchema dbs)
void mergeDatabaseSchema (DatabaseSchema dbs)
abstract void scheduleReadRequest (SelectRequest request) throws SQLException
abstract void readCompletedNotify (SelectRequest request)
final void readCompleted (SelectRequest request)
final void scheduleWriteRequest (AbstractWriteRequest request) throws SQLException, RollbackException
abstract void scheduleNonSuspendedWriteRequest (AbstractWriteRequest request) throws SQLException, RollbackException
final void writeCompleted (AbstractWriteRequest request)
abstract void notifyWriteCompleted (AbstractWriteRequest request)
final long begin (TransactionMarkerMetaData tm) throws SQLException
final void beginCompleted (long transactionId)
final void commit (TransactionMarkerMetaData tm) throws SQLException
final void commitCompleted (long transactionId)
final void rollback (TransactionMarkerMetaData tm) throws SQLException
final void rollbackCompleted (long transactionId)
final void suspendNewTransactionsForCheckpoint () throws SQLException
final void resumeNewTransactions ()
void suspendWrites () throws SQLException
void resumeWrites ()
String getXml ()
String[] getSchedulerData ()
int getNumberRead ()
int getNumberWrite ()
int getPendingTransactions ()

Protected メソッド

boolean hasSQLMacros (AbstractRequest request)
abstract void commitTransaction (long transactionId)
abstract void rollbackTransaction (long transactionId)
abstract String getXmlImpl ()

Protected 変数

int raidbLevel
int parsingGranularity

Static Protected 変数

Trace logger

Private 変数

long tid
boolean suspendedTransactions = false
int pendingTransactions
Object transactionSync = new Object()
Object endOfCurrentTransactions = new Object()
boolean suspendedWrites = false
int pendingWrites
Object writesSync = new Object()
Object endOfCurrentWrites = new Object()
int numberRead = 0
int numberWrite = 0


コンストラクタとデストラクタ

org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.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(), ...).

引数:
raidbLevel RAIDb level of this scheduler
parsingGranularity Parsing granularity needed by the scheduler

AbstractScheduler.java99 行で定義されています。

00100   {
00101     this.raidbLevel = raidbLevel;
00102     this.parsingGranularity = parsingGranularity;
00103     this.tid = 0;
00104     this.pendingTransactions = 0;
00105     this.pendingWrites = 0;
00106   }


メソッド

final long org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.begin TransactionMarkerMetaData  tm  )  throws SQLException
 

Begin a new transaction and return the corresponding transaction identifier. This method is called from the driver when setAutoCommit(false) is called.

引数:
tm The transaction marker metadata
戻り値:
the transaction identifier
例外:
SQLException if an error occurs

AbstractScheduler.java371 行で定義されています。

参照元 org.objectweb.cjdbc.controller.requestmanager.distributed.DistributedRequestManager.begin().

00372   {
00373     // Check if writes are suspended
00374     synchronized (writesSync)
00375     {
00376       if (suspendedWrites)
00377       {
00378         try
00379         {
00380           // Wait on writesSync
00381           long timeout = tm.getTimeout();
00382           if (timeout > 0)
00383           {
00384             long start = System.currentTimeMillis();
00385             writesSync.wait(timeout);
00386             long end = System.currentTimeMillis();
00387             long remaining = timeout - (end - start);
00388             if (remaining > 0)
00389               tm.setTimeout(remaining);
00390             else
00391             {
00392               String msg = Translate.get("scheduler.begin.timeout.writeSync");
00393               logger.warn(msg);
00394               throw new SQLException(msg);
00395             }
00396           }
00397           else
00398             writesSync.wait();
00399         }
00400         catch (InterruptedException e)
00401         {
00402           String msg = Translate.get("scheduler.begin.timeout.writeSync")
00403               + " (" + e + ")";
00404           logger.error(msg);
00405           throw new SQLException(msg);
00406         }
00407       }
00408       pendingWrites++;
00409     }
00410 
00411     // Check if transactions are suspended
00412     synchronized (transactionSync)
00413     {
00414       if (suspendedTransactions)
00415         try
00416         {
00417           // Wait on transactionSync
00418           long timeout = tm.getTimeout();
00419           if (timeout > 0)
00420           {
00421             long start = System.currentTimeMillis();
00422             transactionSync.wait(timeout);
00423             long end = System.currentTimeMillis();
00424             long remaining = timeout - (end - start);
00425             if (remaining > 0)
00426               tm.setTimeout(remaining);
00427             else
00428             {
00429               String msg = Translate
00430                   .get("scheduler.begin.timeout.transactionSync");
00431               logger.warn(msg);
00432               throw new SQLException(msg);
00433             }
00434           }
00435           else
00436             transactionSync.wait();
00437         }
00438         catch (InterruptedException e)
00439         {
00440           String msg = Translate.get("scheduler.begin.timeout.transactionSync")
00441               + " (" + e + ")";
00442           logger.error(msg);
00443           throw new SQLException(msg);
00444         }
00445       tid++;
00446       pendingTransactions++;
00447       return tid;
00448     }
00449   }

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.beginCompleted long  transactionId  ) 
 

Notify the completion of a begin command.

引数:
transactionId of the completed begin

AbstractScheduler.java456 行で定義されています。

参照元 org.objectweb.cjdbc.controller.requestmanager.distributed.DistributedRequestManager.begin().

00457   {
00458     // Take care of suspended write
00459     synchronized (writesSync)
00460     {
00461       pendingWrites--;
00462 
00463       // It this is the last write to complete and writes are
00464       // suspended we have to notify suspendedWrites()
00465       if (suspendedWrites && (pendingWrites == 0))
00466       {
00467         synchronized (endOfCurrentWrites)
00468         {
00469           endOfCurrentWrites.notifyAll();
00470         }
00471       }
00472     }
00473   }

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.commit TransactionMarkerMetaData  tm  )  throws SQLException
 

Commit a transaction.

Calls the implementation specific commitTransaction()

引数:
tm The transaction marker metadata
例外:
SQLException if an error occurs
参照:
commitTransaction(long)

AbstractScheduler.java484 行で定義されています。

00485   {
00486     // Check if writes are suspended
00487     synchronized (writesSync)
00488     {
00489       if (suspendedWrites)
00490       {
00491         try
00492         {
00493           // Wait on writesSync
00494           long timeout = tm.getTimeout();
00495           if (timeout > 0)
00496           {
00497             long start = System.currentTimeMillis();
00498             writesSync.wait(timeout);
00499             long end = System.currentTimeMillis();
00500             long remaining = timeout - (end - start);
00501             if (remaining > 0)
00502               tm.setTimeout(remaining);
00503             else
00504             {
00505               String msg = Translate.get("scheduler.commit.timeout.writeSync");
00506               logger.warn(msg);
00507               throw new SQLException(msg);
00508             }
00509           }
00510           else
00511             writesSync.wait();
00512         }
00513         catch (InterruptedException e)
00514         {
00515           String msg = Translate.get("scheduler.commit.timeout.writeSync")
00516               + " (" + e + ")";
00517           logger.error(msg);
00518           throw new SQLException(msg);
00519         }
00520       }
00521       pendingWrites++;
00522     }
00523     commitTransaction(tm.getTransactionId());
00524   }

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.commitCompleted long  transactionId  ) 
 

Notify the completion of a commit command.

引数:
transactionId of the completed commit

AbstractScheduler.java539 行で定義されています。

00540   {
00541     // Take care of suspended transactions
00542     synchronized (transactionSync)
00543     {
00544       pendingTransactions--;
00545 
00546       // If it is the last pending transaction to complete and we
00547       // are waiting for pending transactions to complete, then wake
00548       // up suspendNewTransactionsForCheckpoint()
00549       if (suspendedTransactions && (pendingTransactions == 0))
00550       {
00551         synchronized (endOfCurrentTransactions)
00552         {
00553           endOfCurrentTransactions.notifyAll();
00554         }
00555       }
00556     }
00557     // Take care of suspended write
00558     synchronized (writesSync)
00559     {
00560       pendingWrites--;
00561 
00562       // It this is the last write to complete and writes are
00563       // suspended we have to notify suspendedWrites()
00564       if (suspendedWrites && (pendingWrites == 0))
00565       {
00566         synchronized (endOfCurrentWrites)
00567         {
00568           endOfCurrentWrites.notifyAll();
00569         }
00570       }
00571     }
00572   }

abstract void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.commitTransaction long  transactionId  )  [protected, pure virtual]
 

Commit a transaction given its id.

引数:
transactionId the transaction id
例外:
RemoteException if an error occurs

org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticQueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBPessimisticTransactionLevelScheduler, と org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBQueryLevelSchedulerを実装しています.

int org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.getNumberRead  ) 
 

戻り値:
Returns the numberRead.

AbstractScheduler.java834 行で定義されています。

参照元 org.objectweb.cjdbc.common.monitor.scheduler.NumberRequestsCollector.getValue().

00835   {
00836     return numberRead;
00837   }

int org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.getNumberWrite  ) 
 

戻り値:
Returns the numberWrite.

AbstractScheduler.java842 行で定義されています。

参照元 org.objectweb.cjdbc.common.monitor.scheduler.NumberRequestsCollector.getValue().

00843   {
00844     return numberWrite;
00845   }

final int org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.getParsingGranularity  ) 
 

Get the needed query parsing granularity.

戻り値:
needed query parsing granularity

AbstractScheduler.java128 行で定義されています。

参照元 org.objectweb.cjdbc.controller.requestmanager.RequestManager.setScheduler().

00129   {
00130     return parsingGranularity;
00131   }

int org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.getPendingTransactions  ) 
 

戻り値:
Returns the pendingTransactions.

AbstractScheduler.java850 行で定義されています。

00851   {
00852     return pendingTransactions;
00853   }

final int org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.getPendingWrites  ) 
 

Returns the number of pending writes.

戻り値:
int

AbstractScheduler.java148 行で定義されています。

参照先 org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.pendingWrites.

参照元 org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticTransactionLevelScheduler.acquireLockAndSetRequestId(), org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2QueryLevelScheduler.notifyWriteCompleted(), org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1QueryLevelScheduler.notifyWriteCompleted(), org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBPessimisticTransactionLevelScheduler.scheduleNonSuspendedWriteRequest(), org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2QueryLevelScheduler.scheduleNonSuspendedWriteRequest(), org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2PessimisticTransactionLevelScheduler.scheduleNonSuspendedWriteRequest(), org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1QueryLevelScheduler.scheduleNonSuspendedWriteRequest(), org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1PessimisticTransactionLevelScheduler.scheduleNonSuspendedWriteRequest(), org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0PessimisticTransactionLevelScheduler.scheduleNonSuspendedWriteRequest(), org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2QueryLevelScheduler.scheduleReadRequest(), と org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1QueryLevelScheduler.scheduleReadRequest().

00149   {
00150     return pendingWrites;
00151   }

final int org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.getRAIDbLevel  ) 
 

Returns the RAIDbLevel.

戻り値:
int

AbstractScheduler.java158 行で定義されています。

参照元 org.objectweb.cjdbc.controller.requestmanager.RequestManager.assignAndCheckSchedulerLoadBalancerValidity().

00159   {
00160     return raidbLevel;
00161   }

String [] org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.getSchedulerData  ) 
 

Returns live information on the scheduler

戻り値:
array of data

AbstractScheduler.java818 行で定義されています。

参照元 org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveSchedulerData().

00819   {
00820     String[] data = new String[7];
00821     data[0] = "" + numberRead;
00822     data[1] = "" + numberWrite;
00823     data[2] = "" + pendingTransactions;
00824     data[3] = "" + pendingWrites;
00825     data[4] = "" + numberRead + numberWrite;
00826     data[5] = (suspendedTransactions) ? "1" : "0";
00827     data[6] = (suspendedWrites) ? "1" : "0";
00828     return data;
00829   }

String org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.getXml  ) 
 

Get information about the Request Scheduler in xml format

戻り値:
String containing information in xml

AbstractScheduler.java804 行で定義されています。

00805   {
00806     StringBuffer info = new StringBuffer();
00807     info.append("<" + DatabasesXmlTags.ELT_RequestScheduler + ">");
00808     info.append(this.getXmlImpl());
00809     info.append("</" + DatabasesXmlTags.ELT_RequestScheduler + ">");
00810     return info.toString();
00811   }

abstract String org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.getXmlImpl  )  [protected, pure virtual]
 

org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticQueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBPessimisticTransactionLevelScheduler, と org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBQueryLevelSchedulerを実装しています.

boolean org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.hasSQLMacros AbstractRequest  request  )  [protected]
 

Returns true if the query contains SQL macros. Currently supported macros are NOW() and RAND().

引数:
request the request to check
戻り値:
true if the query contains SQL macros.

AbstractScheduler.java348 行で定義されています。

参照先 org.objectweb.cjdbc.common.sql.AbstractRequest.getSQL().

00349   {
00350     String lower = request.getSQL().toLowerCase();
00351     if (lower.indexOf("now()") > 0)
00352       return true;
00353     if (lower.indexOf("rand()") > 0)
00354       return true;
00355     return false;
00356   }

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.initializeTransactionId long  transactionId  ) 
 

Initialize the transaction id with the given value (usually retrieved from the recovery log).

引数:
transactionId new current transaction identifier

AbstractScheduler.java118 行で定義されています。

00119   {
00120     this.tid = transactionId;
00121   }

void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.mergeDatabaseSchema DatabaseSchema  dbs  ) 
 

Merge the given DatabaseSchema with the current one.

引数:
dbs a DatabaseSchema value
参照:
org.objectweb.cjdbc.controller.scheduler.schema.SchedulerDatabaseSchema

org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticTransactionLevelSchedulerで再定義されています。

AbstractScheduler.java193 行で定義されています。

参照先 org.objectweb.cjdbc.common.log.Trace.info().

00194   {
00195     logger.info(Translate.get("scheduler.doesnt.support.schemas"));
00196   }

abstract void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.notifyWriteCompleted AbstractWriteRequest  request  )  [pure virtual]
 

Notify the completion of a write statement. This method does not need to be synchronized, it is enforced by the caller.

引数:
request the completed request
参照:
writeCompleted(AbstractWriteRequest)

org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticQueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBPessimisticTransactionLevelScheduler, と org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBQueryLevelSchedulerを実装しています.

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.readCompleted SelectRequest  request  ) 
 

Notify the completion of a read statement.

引数:
request the completed request

AbstractScheduler.java225 行で定義されています。

参照先 org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.numberRead.

00226   {
00227     numberRead++;
00228     this.readCompletedNotify(request);
00229   }

abstract void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.readCompletedNotify SelectRequest  request  )  [pure virtual]
 

Notify the completion of a read statement.

引数:
request the completed request

org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticQueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBPessimisticTransactionLevelScheduler, と org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBQueryLevelSchedulerを実装しています.

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.resumeNewTransactions  ) 
 

Resume new transactions that were suspended by suspendNewTransactionsForCheckpoint().

参照:
suspendNewTransactionsForCheckpoint()

AbstractScheduler.java726 行で定義されています。

00727   {
00728     synchronized (transactionSync)
00729     {
00730       suspendedTransactions = false;
00731       // Wake up all pending begin statements
00732       transactionSync.notifyAll();
00733     }
00734   }

void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.resumeWrites  ) 
 

Resume the execution of write queries that were suspended by suspendWrites().

参照:
suspendWrites()

AbstractScheduler.java783 行で定義されています。

00784   {
00785     synchronized (writesSync)
00786     {
00787       suspendedWrites = false;
00788       // Wake up all waiting writes
00789       writesSync.notifyAll();
00790     }
00791   }

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.rollback TransactionMarkerMetaData  tm  )  throws SQLException
 

Rollback a transaction.

Calls the implementation specific rollbackTransaction()

引数:
tm The transaction marker metadata
例外:
SQLException if an error occurs
参照:
rollbackTransaction(long)

AbstractScheduler.java583 行で定義されています。

00584   {
00585     // Check if writes are suspended
00586     synchronized (writesSync)
00587     {
00588       if (suspendedWrites)
00589       {
00590         try
00591         {
00592           // Wait on writesSync
00593           long timeout = tm.getTimeout();
00594           if (timeout > 0)
00595           {
00596             long start = System.currentTimeMillis();
00597             writesSync.wait(timeout);
00598             long end = System.currentTimeMillis();
00599             long remaining = timeout - (end - start);
00600             if (remaining > 0)
00601               tm.setTimeout(remaining);
00602             else
00603             {
00604               String msg = Translate
00605                   .get("scheduler.rollback.timeout.writeSync");
00606               logger.warn(msg);
00607               throw new SQLException(msg);
00608             }
00609           }
00610           else
00611             writesSync.wait();
00612         }
00613         catch (InterruptedException e)
00614         {
00615           String msg = Translate.get("scheduler.rollback.timeout.writeSync")
00616               + " (" + e + ")";
00617           logger.error(msg);
00618           throw new SQLException(msg);
00619         }
00620       }
00621       pendingWrites++;
00622     }
00623     rollbackTransaction(tm.getTransactionId());
00624   }

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.rollbackCompleted long  transactionId  ) 
 

Notify the completion of a rollback command.

引数:
transactionId of the rollback commit

AbstractScheduler.java639 行で定義されています。

00640   {
00641     // Take care of suspended transactions
00642     synchronized (transactionSync)
00643     {
00644       pendingTransactions--;
00645 
00646       // If it is the last pending transaction to complete and we
00647       // are waiting for pending transactions to complete, then wake
00648       // up suspendNewTransactionsForCheckpoint()
00649       if (suspendedTransactions && (pendingTransactions == 0))
00650       {
00651         synchronized (endOfCurrentTransactions)
00652         {
00653           endOfCurrentTransactions.notifyAll();
00654         }
00655       }
00656     }
00657     // Take care of suspended write
00658     synchronized (writesSync)
00659     {
00660       pendingWrites--;
00661 
00662       // It this is the last write to complete and writes are
00663       // suspended we have to notify suspendedWrites()
00664       if (suspendedWrites && (pendingWrites == 0))
00665       {
00666         synchronized (endOfCurrentWrites)
00667         {
00668           endOfCurrentWrites.notifyAll();
00669         }
00670       }
00671     }
00672   }

abstract void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.rollbackTransaction long  transactionId  )  [protected, pure virtual]
 

Rollback a transaction given its id.

引数:
transactionId the transaction id
例外:
RemoteException if an error occurs

org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticQueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBPessimisticTransactionLevelScheduler, と org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBQueryLevelSchedulerを実装しています.

abstract void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.scheduleNonSuspendedWriteRequest AbstractWriteRequest  request  )  throws SQLException, RollbackException [pure virtual]
 

Schedule a write request (implementation specific). This method blocks until the request can be executed.

引数:
request Write request to schedule (SQL macros are already handled if needed)
例外:
SQLException if a timeout occurs
RollbackException if the transaction must be rollbacked

org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticQueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBPessimisticTransactionLevelScheduler, と org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBQueryLevelSchedulerを実装しています.

abstract void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.scheduleReadRequest SelectRequest  request  )  throws SQLException [pure virtual]
 

Schedule a read request (implementation specific). This method blocks until the read can be executed.

引数:
request Select request to schedule (SQL macros are already handled if needed)
例外:
SQLException if a timeout occurs

org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb0.RAIDb0QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticQueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2PessimisticTransactionLevelScheduler, org.objectweb.cjdbc.controller.scheduler.raidb2.RAIDb2QueryLevelScheduler, org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBPessimisticTransactionLevelScheduler, と org.objectweb.cjdbc.controller.scheduler.singledb.SingleDBQueryLevelSchedulerを実装しています.

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.scheduleWriteRequest AbstractWriteRequest  request  )  throws SQLException, RollbackException
 

Schedule a write request. This method blocks if the writes are suspended. Then the number of pending writes is updated and the implementation specific scheduleNonSuspendedWriteRequest function is called. SQL macros are replaced in the request if the scheduler has needSQLMacroHandling set to true.

引数:
request Write request to schedule
例外:
SQLException if a timeout occurs
RollbackException if an error occurs
参照:
scheduleNonSuspendedWriteRequest(AbstractWriteRequest)

AbstractScheduler.java243 行で定義されています。

参照先 org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.pendingWrites, org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.suspendedWrites, org.objectweb.cjdbc.common.log.Trace.warn(), と org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.writesSync.

00245   {
00246     synchronized (writesSync)
00247     {
00248       if (suspendedWrites)
00249       {
00250         try
00251         {
00252           // Wait on writesSync
00253           int timeout = request.getTimeout();
00254           if (timeout > 0)
00255           {
00256             long start = System.currentTimeMillis();
00257             long lTimeout = timeout * 1000;
00258             writesSync.wait(lTimeout);
00259             long end = System.currentTimeMillis();
00260             int remaining = (int) (lTimeout - (end - start));
00261             if (remaining > 0)
00262               request.setTimeout(remaining);
00263             else
00264             {
00265               String msg = Translate.get("scheduler.request.timeout",
00266                   new String[]{String.valueOf(request.getId()),
00267                       String.valueOf(request.getTimeout())});
00268               logger.warn(msg);
00269               throw new SQLException(msg);
00270             }
00271           }
00272           else
00273             this.writesSync.wait();
00274         }
00275         catch (InterruptedException e)
00276         {
00277           String msg = Translate.get("scheduler.request.timeout.failed", e);
00278           logger.warn(msg);
00279           throw new SQLException(msg);
00280         }
00281       }
00282       pendingWrites++;
00283     }
00284     scheduleNonSuspendedWriteRequest(request);
00285   }

void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.setDatabaseSchema DatabaseSchema  dbs  ) 
 

Sets the 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 value
参照:
org.objectweb.cjdbc.controller.scheduler.schema.SchedulerDatabaseSchema

org.objectweb.cjdbc.controller.scheduler.raidb1.RAIDb1OptimisticTransactionLevelSchedulerで再定義されています。

AbstractScheduler.java181 行で定義されています。

参照先 org.objectweb.cjdbc.common.log.Trace.info(), と org.objectweb.cjdbc.common.log.Trace.isInfoEnabled().

00182   {
00183     if (logger.isInfoEnabled())
00184       logger.info(Translate.get("scheduler.doesnt.support.schemas"));
00185   }

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.setParsingGranularity int  parsingGranularity  ) 
 

Set the needed query parsing granularity.

引数:
parsingGranularity Parsing granularity needed by the scheduler

AbstractScheduler.java138 行で定義されています。

00139   {
00140     this.parsingGranularity = parsingGranularity;
00141   }

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.setRAIDbLevel int  raidbLevel  ) 
 

Sets the RAIDb level.

引数:
raidbLevel The RAIDbLevel to set

AbstractScheduler.java168 行で定義されています。

00169   {
00170     this.raidbLevel = raidbLevel;
00171   }

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.suspendNewTransactionsForCheckpoint  )  throws SQLException
 

Suspend all calls to begin() until all current transactions are finished in order to store a checkpoint. This method returns when all pending transactions have finished.

New transactions remain suspended until resumeNewTransactions() is called.

参照:
resumeNewTransactions()

AbstractScheduler.java687 行で定義されています。

00688   {
00689     synchronized (transactionSync)
00690     {
00691       suspendedTransactions = true;
00692       if (pendingTransactions == 0)
00693         return;
00694     }
00695 
00696     synchronized (endOfCurrentTransactions)
00697     {
00698       // Here we have a potential synchronization problem since the last
00699       // transaction completion could have happened before we entered this
00700       // synchronized block. Therefore we recheck if there is effectively
00701       // still pending transactions. If this is not the case, we don't have
00702       // to sleep and we can immediately return.
00703       if (pendingTransactions == 0)
00704         return;
00705 
00706       // Wait for pending transactions to end
00707       try
00708       {
00709         endOfCurrentTransactions.wait();
00710       }
00711       catch (InterruptedException e)
00712       {
00713         String msg = Translate.get("scheduler.suspend.transaction.failed", e);
00714         logger.error(msg);
00715         throw new SQLException(msg);
00716       }
00717     }
00718   }

void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.suspendWrites  )  throws SQLException
 

Suspend all write queries. This method blocks until all pending writes are completed.

Writes execution is resumed by calling resumeWrites()

参照:
resumeWrites()

AbstractScheduler.java744 行で定義されています。

00745   {
00746     synchronized (writesSync)
00747     {
00748       suspendedWrites = true;
00749       if (pendingWrites == 0)
00750         return;
00751     }
00752 
00753     synchronized (endOfCurrentWrites)
00754     {
00755       // Here we have a potential synchronization problem since the last
00756       // write completion could have happened before we entered this
00757       // synchronized block. Therefore we recheck if there is effectively
00758       // still pending writes. If this is not the case, we don't have
00759       // to sleep and we can immediately return.
00760       if (pendingWrites == 0)
00761         return;
00762 
00763       // Wait for pending transactions to end
00764       try
00765       {
00766         endOfCurrentWrites.wait();
00767       }
00768       catch (InterruptedException e)
00769       {
00770         String msg = Translate.get("scheduler.suspend.writes.failed", e);
00771         logger.error(msg);
00772         throw new SQLException(msg);
00773       }
00774     }
00775   }

final void org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.writeCompleted AbstractWriteRequest  request  ) 
 

Notify the completion of a write statement.

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 request
参照:
notifyWriteCompleted(AbstractWriteRequest)

suspendWrites()

AbstractScheduler.java311 行で定義されています。

00312   {
00313     synchronized (writesSync)
00314     {
00315       pendingWrites--;
00316 
00317       notifyWriteCompleted(request);
00318 
00319       // It this is the last write to complete and writes are
00320       // suspended we have to notify suspendedWrites()
00321       if (suspendedWrites && (pendingWrites == 0))
00322       {
00323         synchronized (endOfCurrentWrites)
00324         {
00325           endOfCurrentWrites.notifyAll();
00326         }
00327       }
00328     }
00329     numberWrite++;
00330   }


変数

Object org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.endOfCurrentTransactions = new Object() [private]
 

AbstractScheduler.java73 行で定義されています。

Object org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.endOfCurrentWrites = new Object() [private]
 

AbstractScheduler.java79 行で定義されています。

Trace org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.logger [static, protected]
 

初期値:

 Trace
                                                      .getLogger("org.objectweb.cjdbc.controller.scheduler")

AbstractScheduler.java81 行で定義されています。

int org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.numberRead = 0 [private]
 

AbstractScheduler.java85 行で定義されています。

参照元 org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.readCompleted().

int org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.numberWrite = 0 [private]
 

AbstractScheduler.java86 行で定義されています。

int org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.parsingGranularity [protected]
 

AbstractScheduler.java66 行で定義されています。

int org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.pendingTransactions [private]
 

AbstractScheduler.java71 行で定義されています。

int org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.pendingWrites [private]
 

AbstractScheduler.java77 行で定義されています。

参照元 org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.getPendingWrites(), と org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.scheduleWriteRequest().

int org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.raidbLevel [protected]
 

AbstractScheduler.java65 行で定義されています。

boolean org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.suspendedTransactions = false [private]
 

AbstractScheduler.java70 行で定義されています。

boolean org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.suspendedWrites = false [private]
 

AbstractScheduler.java76 行で定義されています。

参照元 org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.scheduleWriteRequest().

long org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.tid [private]
 

AbstractScheduler.java69 行で定義されています。

Object org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.transactionSync = new Object() [private]
 

AbstractScheduler.java72 行で定義されています。

Object org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.writesSync = new Object() [private]
 

AbstractScheduler.java78 行で定義されています。

参照元 org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.scheduleWriteRequest().


このクラスの説明は次のファイルから生成されました:
CJDBCversion1.0rc6に対してWed May 5 18:02:58 2004に生成されました。 doxygen 1.3.6