| |
|
| java.lang.Object org.continuent.sequoia.controller.scheduler.AbstractScheduler
All known Subclasses: org.continuent.sequoia.controller.scheduler.raidb2.RAIDb2PassThroughScheduler, org.continuent.sequoia.controller.scheduler.singledb.SingleDBPessimisticTransactionLevelScheduler, org.continuent.sequoia.controller.scheduler.raidb2.RAIDb2QueryLevelScheduler, org.continuent.sequoia.controller.scheduler.raidb2.RAIDb2PessimisticTransactionLevelScheduler, org.continuent.sequoia.controller.scheduler.raidb1.RAIDb1PessimisticTransactionLevelScheduler, org.continuent.sequoia.controller.scheduler.raidb0.RAIDb0PassThroughLevelScheduler, org.continuent.sequoia.controller.scheduler.singledb.SingleDBPassThroughScheduler, org.continuent.sequoia.controller.scheduler.raidb0.RAIDb0PessimisticTransactionLevelScheduler, org.continuent.sequoia.controller.scheduler.raidb1.RAIDb1QueryLevelScheduler, org.continuent.sequoia.controller.scheduler.raidb1.RAIDb1OptimisticTransactionLevelScheduler, org.continuent.sequoia.controller.scheduler.raidb1.RAIDb1PassThroughScheduler, org.continuent.sequoia.controller.scheduler.raidb1.RAIDb1OptimisticQueryLevelScheduler,
AbstractScheduler | abstract public class AbstractScheduler implements XmlComponent(Code) | | 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).
author: Emmanuel Cecchet author: Jean-Bernard van Zuylen author: author: Damian Arregui version: 1.0 |
Constructor Summary | |
public | AbstractScheduler(int raidbLevel, int parsingGranularity, VirtualDatabase vdb, long waitForSuspendedTransactionsTimeout, long waitForPersistentConnectionsTimeout) Default scheduler to assign scheduler RAIDb level, needed granularity and
SQL macro handling (on the fly instanciation of NOW(), RAND(), ...). | public | 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 | |
final public void | begin(TransactionMetaData tm, boolean isLazyStart, AbstractRequest request) Begin a new transaction with the transaction identifier provided in the
transaction meta data parameter. | final public void | beginCompleted(long transactionId) Notify the completion of a begin command. | public void | closePersistentConnectionCompleted(long persistentConnectionId) Signals the completion of a persistent connection closing operation. | final public void | commit(TransactionMetaData tm, boolean emptyTransaction, DistributedCommit dmsg) Commit a transaction. | final public void | commitCompleted(TransactionMetaData tm, boolean isSuccess) Notify the completion of a commit command. | abstract protected void | commitTransaction(long transactionId) Commit a transaction given its id. | final public Map | getActiveReadRequests() Returns the list of active read requests . | final public List | getActiveTransactions() Returns the list of active transactions (list contains transaction ids). | final public Map | getActiveWriteRequests() Returns the list of active write requests . | public long | getNextTransactionId() | public int | getNumberRead() | public int | getNumberWrite() | public Hashtable | getOpenPersistentConnections() Returns a hashtable of all the open persistent connections (and their
associated login). | final public int | getParsingGranularity() Get the needed query parsing granularity. | public int | getPendingTransactions() | final public int | getPendingWrites() Returns the number of pending writes. | public String | getPersistentConnectionLogin(Long persistentConnectionId) Returns the login associated with a given persistent connection. | final public int | getRAIDbLevel() Returns the RAIDbLevel. | public String[] | getSchedulerData() | public String | getXml() | abstract protected String | getXmlImpl() | public boolean | hasPersistentConnection(long persistentConnectionId) | public synchronized int | incrementSavepointId() | final public void | initializeTransactionId(long transactionId) Initialize the transaction id with the given value (usually retrieved from
the recovery log). | public boolean | isActiveRequest(long requestId) Returns true if the given request id is in the active request list. | public boolean | isSuspendedRequest(Object obj) Checks if an object is in the suspended requests list. | public boolean | isSuspendedWrites() | public void | mergeDatabaseSchema(DatabaseSchema dbs) Merge the given DatabaseSchema with the current one. | abstract protected void | notifyStoredProcedureCompleted(StoredProcedure proc) Notify the completion of a stored procedure. | abstract protected void | notifyWriteCompleted(AbstractWriteRequest request) Notify the completion of a write statement. | public void | openPersistentConnectionCompleted(long persistentConnectionId, boolean success) Notify open persistent connection completion. | final public void | readCompleted(SelectRequest request) Notify the completion of a read statement. | abstract protected void | readCompletedNotify(SelectRequest request) Notify the completion of a read statement. | final public void | releaseSavepoint(TransactionMetaData tm, String name, DistributedReleaseSavepoint dmsg) Release a savepoint. | abstract protected void | releaseSavepointTransaction(long transactionId, String name) Release a savepoint given its name from a transaction given its id. | final public void | resumeNewPersistentConnections() Resume new persistent connections creations that were suspended by
suspendNewPersistentConnections(). | final public void | resumeNewTransactions() Resume new transactions that were suspended by
suspendNewTransactionsForCheckpoint(). | public void | resumeOpenClosePersistentConnection() Resumes openinh and closing of persistent connections. | public void | resumeWrites() Resume the execution of the new write queries that were
suspended by suspendNewWrites() . | public void | resumeWritesTransactionsAndPersistentConnections() Resume suspended writes, transactions and persistent connections (in this
order). | final public void | rollback(TransactionMetaData tm, DistributedRollback dmsg) Rollback a transaction. | final public void | rollback(TransactionMetaData tm, String savepointName, DistributedRollbackToSavepoint dmsg) Rollback a transaction to a savepoint. | final public void | rollbackCompleted(TransactionMetaData tm, boolean isSuccess) Notify the completion of a rollback command. | abstract protected void | rollbackTransaction(long transactionId) Rollback a transaction given its id. | abstract protected void | rollbackTransaction(long transactionId, String savepointName) Rollback a transaction given its id to a savepoint given its name. | final public void | savepointCompleted(long transactionId) Notify the conpletion of a savepoint action. | public void | scheduleClosePersistentConnection() Schedule a close persistent connection. | abstract protected void | scheduleNonSuspendedReadRequest(SelectRequest request) | abstract protected void | scheduleNonSuspendedStoredProcedure(StoredProcedure proc) Schedule a write request (implementation specific). | abstract protected void | scheduleNonSuspendedWriteRequest(AbstractWriteRequest request) Schedule a write request (implementation specific). | public void | scheduleOpenPersistentConnection(DistributedOpenPersistentConnection dmsg) Signals the start of a persistent connection opening operation. | public void | scheduleReadRequest(SelectRequest request) | final public void | scheduleStoredProcedure(StoredProcedure proc) Schedule a write request. | final public void | scheduleWriteRequest(AbstractWriteRequest request) Schedule a write request. | public void | setControllerId(long controllerId) Assigns the local controllerId. | public void | setDatabaseSchema(DatabaseSchema dbs) Sets the DatabaseSchema of the current virtual database. | final public int | setSavepoint(TransactionMetaData tm) Set an unnamed savepoint. | final public void | setSavepoint(TransactionMetaData tm, String name, DistributedSetSavepoint dmsg) Set a named savepoint. | abstract protected void | setSavepointTransaction(long transactionId, String name) Set a savepoint given its name to a transaction given its id. | final public void | storedProcedureCompleted(StoredProcedure proc) Notify the completion of a stored procedure. | public void | suspendNewPersistentConnections() Suspend all new persistent connections creation. | final public void | suspendNewTransactions() Suspend all calls to begin() until until resumeWrites() is called. | public void | suspendNewTransactionsAndWrites() Suspend all calls to begin() until until resumeWrites() and
resumeNewTransactions are called. | public void | suspendNewWrites() Suspend all new write queries until resumeWrites() is called.
This method does not block and returns immediately. | public void | suspendOpenClosePersistentConnection() Suspends open and closing of persistent connections. | public void | waitForPendingOpenClosePersistentConnection() Blocks until all pending open/close persistent connections operations are
completed. | public void | waitForPersistentConnectionsToComplete() Wait for opened persistent connections to complete. | public void | waitForRequestCompletion(long requestId) Wait for the completion of the given request id. | public void | waitForSuspendedTransactionsToComplete() Wait for suspended transactions to complete. | public void | waitForSuspendedWritesToComplete() Wait for suspended writes to complete. | final public void | writeCompleted(AbstractWriteRequest request) Notify the completion of a write statement. |
activePersistentConnections | protected Hashtable activePersistentConnections(Code) | | List of persistent connections that have been created
persistentConnectionId (Long) -> vLogin (String)
|
parsingGranularity | protected int parsingGranularity(Code) | | |
raidbLevel | protected int raidbLevel(Code) | | |
AbstractScheduler | public AbstractScheduler(int raidbLevel, int parsingGranularity, VirtualDatabase vdb, long waitForSuspendedTransactionsTimeout, long waitForPersistentConnectionsTimeout)(Code) | | Default scheduler to assign scheduler RAIDb level, needed granularity and
SQL macro handling (on the fly instanciation of NOW(), RAND(), ...).
Parameters: raidbLevel - RAIDb level of this scheduler Parameters: parsingGranularity - Parsing granularity needed by the scheduler Parameters: vdb - virtual database using this scheduler (needed to access itstotal order queue) |
AbstractScheduler | public AbstractScheduler(int raidbLevel, int parsingGranularity)(Code) | | Default scheduler to assign scheduler RAIDb level, needed granularity and
SQL macro handling (on the fly instanciation of NOW(), RAND(), ...).
Parameters: raidbLevel - RAIDb level of this scheduler Parameters: parsingGranularity - Parsing granularity needed by the scheduler |
begin | final public void begin(TransactionMetaData tm, boolean isLazyStart, AbstractRequest request) throws SQLException(Code) | | Begin a new transaction with the transaction identifier provided in the
transaction meta data parameter. Note that this id must retrieve beforehand
by calling getNextTransactionId(). This method is called from the driver
when setAutoCommit(false) is called.
Parameters: tm - The transaction marker metadata Parameters: isLazyStart - true if this begin is triggered by a lazy transactionstart of a transaction initiated by a remote controller. In thatcase, suspended transactions will be ignored (but not suspendedwrites) Parameters: request - request which triggered this operation throws: SQLException - if an error occurs |
beginCompleted | final public void beginCompleted(long transactionId)(Code) | | Notify the completion of a begin command.
Parameters: transactionId - of the completed begin |
closePersistentConnectionCompleted | public void closePersistentConnectionCompleted(long persistentConnectionId)(Code) | | Signals the completion of a persistent connection closing operation.
Parameters: persistentConnectionId - id of the closed persistent connection |
commitCompleted | final public void commitCompleted(TransactionMetaData tm, boolean isSuccess)(Code) | | Notify the completion of a commit command.
Parameters: tm - The transaction marker metadata Parameters: isSuccess - true if commit was successful, false otherwise |
commitTransaction | abstract protected void commitTransaction(long transactionId)(Code) | | Commit a transaction given its id.
Parameters: transactionId - the transaction id |
getActiveReadRequests | final public Map getActiveReadRequests()(Code) | | Returns the list of active read requests .
Returns the active read requests. |
getActiveTransactions | final public List getActiveTransactions()(Code) | | Returns the list of active transactions (list contains transaction ids).
Returns the active transaction ids. |
getActiveWriteRequests | final public Map getActiveWriteRequests()(Code) | | Returns the list of active write requests .
Write requests can be either StoredProcedure or AbstractWriteRequest
objects.
Returns the active write requests. |
getNextTransactionId | public long getNextTransactionId()(Code) | | Retrieve the next transaction identifier
next transaction identifier |
getNumberRead | public int getNumberRead()(Code) | | Returns the numberRead. |
getNumberWrite | public int getNumberWrite()(Code) | | Returns the numberWrite. |
getOpenPersistentConnections | public Hashtable getOpenPersistentConnections()(Code) | | Returns a hashtable of all the open persistent connections (and their
associated login).
persistent connection hashtable |
getParsingGranularity | final public int getParsingGranularity()(Code) | | Get the needed query parsing granularity.
needed query parsing granularity |
getPendingTransactions | public int getPendingTransactions()(Code) | | Returns the pendingTransactions. |
getPendingWrites | final public int getPendingWrites()(Code) | | Returns the number of pending writes.
int |
getPersistentConnectionLogin | public String getPersistentConnectionLogin(Long persistentConnectionId)(Code) | | Returns the login associated with a given persistent connection.
Parameters: persistentConnectionId - the id of the persistent connection the associated login |
getRAIDbLevel | final public int getRAIDbLevel()(Code) | | Returns the RAIDbLevel.
int |
getSchedulerData | public String[] getSchedulerData()(Code) | | Returns live information on the scheduler
array of data |
getXml | public String getXml()(Code) | | Get information about the Request Scheduler in xml format
String containing information in xml |
incrementSavepointId | public synchronized int incrementSavepointId()(Code) | | Increments the savepoint id for un-named savepoints
the next savepoint Id |
initializeTransactionId | final public void initializeTransactionId(long transactionId)(Code) | | Initialize the transaction id with the given value (usually retrieved from
the recovery log).
Parameters: transactionId - new current transaction identifier |
isActiveRequest | public boolean isActiveRequest(long requestId)(Code) | | Returns true if the given request id is in the active request list.
Parameters: requestId - the request unique id true if the request is active, false otherwise |
isSuspendedRequest | public boolean isSuspendedRequest(Object obj)(Code) | | Checks if an object is in the suspended requests list.
Parameters: obj - request to be checked true if the request is suspended, false otherwise |
isSuspendedWrites | public boolean isSuspendedWrites()(Code) | | Returns the suspendedWrites. |
openPersistentConnectionCompleted | public void openPersistentConnectionCompleted(long persistentConnectionId, boolean success)(Code) | | Notify open persistent connection completion. If it failed the connection
is removed from the persistentConnections table.
Parameters: persistentConnectionId - id of the opened persistent connection Parameters: success - true if connection opening was successful in which case theconnection is added to the persistent connection list |
readCompleted | final public void readCompleted(SelectRequest request) throws SQLException(Code) | | Notify the completion of a read statement.
Parameters: request - the completed request throws: SQLException - if the query was not in the list of active readrequests (not scheduled) |
readCompletedNotify | abstract protected void readCompletedNotify(SelectRequest request)(Code) | | Notify the completion of a read statement.
Parameters: request - the completed request |
releaseSavepoint | final public void releaseSavepoint(TransactionMetaData tm, String name, DistributedReleaseSavepoint dmsg) throws SQLException(Code) | | Release a savepoint.
Calls the implementation specific releaseSavepointTransaction()
Parameters: tm - transaction marker metadata Parameters: name - name of the savepoint Parameters: dmsg - distributed message which triggered this operation throws: SQLException - if an error occurs |
releaseSavepointTransaction | abstract protected void releaseSavepointTransaction(long transactionId, String name)(Code) | | Release a savepoint given its name from a transaction given its id.
Parameters: transactionId - the transaction id Parameters: name - the name of the savepoint |
resumeOpenClosePersistentConnection | public void resumeOpenClosePersistentConnection()(Code) | | Resumes openinh and closing of persistent connections.
|
resumeWritesTransactionsAndPersistentConnections | public void resumeWritesTransactionsAndPersistentConnections()(Code) | | Resume suspended writes, transactions and persistent connections (in this
order).
|
rollback | final public void rollback(TransactionMetaData tm, String savepointName, DistributedRollbackToSavepoint dmsg) throws SQLException(Code) | | Rollback a transaction to a savepoint.
Calls the implementation specific rollbackTransaction()
Parameters: tm - transaction marker metadata Parameters: savepointName - name of the savepoint Parameters: dmsg - distributed message which triggered this operation throws: SQLException - if an error occurs |
rollbackCompleted | final public void rollbackCompleted(TransactionMetaData tm, boolean isSuccess)(Code) | | Notify the completion of a rollback command.
Parameters: tm - The transaction marker metadata Parameters: isSuccess - true if commit was successful, false otherwise |
rollbackTransaction | abstract protected void rollbackTransaction(long transactionId)(Code) | | Rollback a transaction given its id.
Parameters: transactionId - the transaction id |
rollbackTransaction | abstract protected void rollbackTransaction(long transactionId, String savepointName)(Code) | | Rollback a transaction given its id to a savepoint given its name.
Parameters: transactionId - the transaction id Parameters: savepointName - the name of the savepoint |
savepointCompleted | final public void savepointCompleted(long transactionId)(Code) | | Notify the conpletion of a savepoint action.
Parameters: transactionId - the transaction identifier |
scheduleClosePersistentConnection | public void scheduleClosePersistentConnection()(Code) | | Schedule a close persistent connection.
|
scheduleNonSuspendedReadRequest | abstract protected void scheduleNonSuspendedReadRequest(SelectRequest request) throws SQLException(Code) | | Schedule a read request (implementation specific)
Parameters: request - Select request to schedule (SQL macros are already handledif needed) exception: SQLException - if a timeout occurs |
scheduleNonSuspendedStoredProcedure | abstract protected void scheduleNonSuspendedStoredProcedure(StoredProcedure proc) throws SQLException, RollbackException(Code) | | Schedule a write request (implementation specific). This method blocks
until the request can be executed.
Parameters: proc - Stored procedure to schedule exception: SQLException - if a timeout occurs exception: RollbackException - if the transaction must be rollbacked |
scheduleNonSuspendedWriteRequest | abstract protected void scheduleNonSuspendedWriteRequest(AbstractWriteRequest request) throws SQLException, RollbackException(Code) | | Schedule a write request (implementation specific). This method blocks
until the request can be executed.
Parameters: request - Write request to schedule (SQL macros are already handled ifneeded) exception: SQLException - if a timeout occurs exception: RollbackException - if the transaction must be rollbacked |
scheduleOpenPersistentConnection | public void scheduleOpenPersistentConnection(DistributedOpenPersistentConnection dmsg)(Code) | | Signals the start of a persistent connection opening operation.
Parameters: dmsg - distributed message which triggered this operation |
scheduleReadRequest | public void scheduleReadRequest(SelectRequest request) throws SQLException(Code) | | Schedule a read request
Parameters: request - select request to schedule exception: SQLException - if a timeout occurs or a query with the same id hasalready been scheduled. |
setControllerId | public void setControllerId(long controllerId)(Code) | | Assigns the local controllerId. It is used for generating transactionIds
for autocommit requests.
Parameters: controllerId - for this controller |
setSavepoint | final public int setSavepoint(TransactionMetaData tm) throws SQLException(Code) | | Set an unnamed savepoint.
Calls the implementation specific setSavepointTransaction()
Parameters: tm - transaction marker metadata savepoint Id throws: SQLException - if an error occurs |
setSavepoint | final public void setSavepoint(TransactionMetaData tm, String name, DistributedSetSavepoint dmsg) throws SQLException(Code) | | Set a named savepoint.
Calls the implementation specific setSavepointTransaction()
Parameters: tm - transaction marker metadata Parameters: name - name of the savepoint Parameters: dmsg - distributed message which triggered this operation throws: SQLException - if an error occurs |
setSavepointTransaction | abstract protected void setSavepointTransaction(long transactionId, String name)(Code) | | Set a savepoint given its name to a transaction given its id.
Parameters: transactionId - the transaction id Parameters: name - the name of the savepoint |
suspendNewTransactionsAndWrites | public void suspendNewTransactionsAndWrites()(Code) | | Suspend all calls to begin() until until resumeWrites() and
resumeNewTransactions are called. This method does not block and returns
immediately. To synchronize on suspended writes completion, you must call
waitForSuspendedWritesToComplete(). Suspending writes and transactions is
done atomically in order to close a window in begin().
New transactions remain suspended until resumeNewTransactions() and
resumeWrites are called.
See Also: AbstractScheduler.resumeNewTransactions() See Also: AbstractScheduler.waitForSuspendedTransactionsToComplete() |
waitForPendingOpenClosePersistentConnection | public void waitForPendingOpenClosePersistentConnection()(Code) | | Blocks until all pending open/close persistent connections operations are
completed.
|
waitForPersistentConnectionsToComplete | public void waitForPersistentConnectionsToComplete() throws SQLException(Code) | | Wait for opened persistent connections to complete. Returns as soon as
number of pending persistent connections has reached 0.
throws: SQLException - if an error occured during wait |
waitForRequestCompletion | public void waitForRequestCompletion(long requestId)(Code) | | Wait for the completion of the given request id. The method returns as soon
as the request completion has been notified to the scheduler.
Parameters: requestId - the unique request identifier |
waitForSuspendedTransactionsToComplete | public void waitForSuspendedTransactionsToComplete() throws SQLException(Code) | | Wait for suspended transactions to complete. Returns as soon as number of
pending transactions has reached 0.
throws: SQLException - if an error occured during wait |
waitForSuspendedWritesToComplete | public void waitForSuspendedWritesToComplete() throws SQLException(Code) | | Wait for suspended writes to complete. Returns as soon as number of pending
writes has reached 0.
throws: SQLException - if an error occured during wait |
|
|
|