|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.cjdbc.controller.recoverylog.AbstractRecoveryLog
org.objectweb.cjdbc.controller.recoverylog.JDBCRecoveryLog
Recovery Log using a database accessed through JDBC.
Field Summary | |
private java.lang.String |
checkpointTable
Checkpoint table name. |
private java.lang.String |
checkpointTableCreateStatement
|
private java.sql.Connection |
connection
Connection to the database. |
private java.lang.String |
driver
Driver name. |
private JDBCLoggerThread |
loggerThread
|
private java.lang.String |
login
User's login. |
private java.lang.String |
logTable
Name of the log table. |
private java.lang.String |
logTableCreateStatement
|
private int |
logTableId
Current maximum value of the primary key in logTable. |
private java.lang.String |
password
User's password. |
private java.sql.PreparedStatement |
pstmt
PreparedStatement used to log requests. |
private int |
timeout
Timeout for SQL requests. |
private java.lang.String |
url
Driver URL. |
Fields inherited from class org.objectweb.cjdbc.controller.recoverylog.AbstractRecoveryLog |
logger |
Constructor Summary | |
JDBCRecoveryLog(java.lang.String driver,
java.lang.String url,
java.lang.String login,
java.lang.String password,
int requestTimeout)
Creates a new JDBCRecoveryLog instance. |
Method Summary | |
void |
begin(TransactionMarkerMetaData tm)
Log the beginning of a new transaction. |
void |
checkRecoveryLogTables()
Checks if the recovery log and checkpoint tables exist, and create them if they do not exist. |
void |
cleanRecoveryLog()
Removes all rollbacked transaction from the recovery log and deletes all begin/commit statements for completed transactions. |
void |
commit(TransactionMarkerMetaData tm)
Log a transaction commit. |
private void |
connectToDatabase()
Gets a connection to the database. |
int |
getCheckpointRequestId(java.lang.String checkpointName)
Get the request id corresponding to a given checkpoint. |
int |
getLogTableId()
Returns the value of logTableId. |
java.lang.String |
getXmlInformation()
Get xml information of the current recovery load in the system. |
private int |
incrementLogTableId()
Increments the value of logTableId. |
private void |
intializeDatabase()
Checks if the tables (log and checkpoint) already exist, else, it creates missing tables on the database. |
void |
logRequest(AbstractWriteRequest request)
Log a write request. |
void |
logRequest(StoredProcedure proc,
boolean isRead)
Log a call to a stored procedure. |
RecoveryTask |
recoverNextRequest(int previousRequestId)
Get the next request (begin/commit/rollback or WriteRequest) from the recovery log given the id of the previously recovered request. |
void |
rollback(TransactionMarkerMetaData tm)
Log a transaction rollback. |
void |
setCheckpointTableCreateStatement(java.lang.String checkpointTableName,
java.lang.String checkpointTableCreateStatement)
Sets the checkpoint table name and create statement. |
void |
setLogTableCreateStatement(java.lang.String logTableName,
java.lang.String logTableCreateStatement)
Sets the log table name and create statement. |
void |
storeCheckpoint(java.lang.String checkpointName)
Store a Checkpoint using the current log state. |
void |
storeCheckpoint(java.lang.String checkpointName,
int requestId)
Store a Checkpoint using the given request id. |
private boolean |
validCheckpointName(java.lang.String checkpointName)
Checks if a checkpoint with the name checkpointName is already stored in the database. |
private void |
waitForTransactionsEnd(boolean forceRollback)
|
Methods inherited from class org.objectweb.cjdbc.controller.recoverylog.AbstractRecoveryLog |
beginRecovery, endRecovery, isRecovering |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.String driver
private java.lang.String url
private java.lang.String login
private java.lang.String password
private java.lang.String logTable
private java.lang.String logTableCreateStatement
private java.lang.String checkpointTable
private java.lang.String checkpointTableCreateStatement
private java.sql.Connection connection
private java.sql.PreparedStatement pstmt
PreparedStatement
used to log requests.
private int logTableId
private int timeout
private JDBCLoggerThread loggerThread
Constructor Detail |
public JDBCRecoveryLog(java.lang.String driver, java.lang.String url, java.lang.String login, java.lang.String password, int requestTimeout)
JDBCRecoveryLog
instance.
driver
- the driver class name.url
- the JDBC URL.login
- the login to use to connect to the database.password
- the password to connect to the database.requestTimeout
- timeout in seconds for update queries.Method Detail |
public void checkRecoveryLogTables()
public void setLogTableCreateStatement(java.lang.String logTableName, java.lang.String logTableCreateStatement)
logTableName
- Name of the log tablelogTableCreateStatement
- The create statement to create the log tablepublic void setCheckpointTableCreateStatement(java.lang.String checkpointTableName, java.lang.String checkpointTableCreateStatement)
checkpointTableName
- name of the checkpoint table.checkpointTableCreateStatement
- the create statement to create the
checkpoint table.public int getLogTableId()
private int incrementLogTableId()
private void intializeDatabase() throws java.sql.SQLException
java.sql.SQLException
private void connectToDatabase() throws java.sql.SQLException
java.sql.SQLException
- if an error occurs.public void logRequest(AbstractWriteRequest request) throws java.sql.SQLException
AbstractRecoveryLog
logRequest
in class AbstractRecoveryLog
request
- The write request to log
java.sql.SQLException
- if an error occursAbstractRecoveryLog.logRequest(AbstractWriteRequest)
public void logRequest(StoredProcedure proc, boolean isRead) throws java.sql.SQLException
AbstractRecoveryLog
logRequest
in class AbstractRecoveryLog
proc
- The stored procedure call to logisRead
- True if the stored procedure call returns a ResultSet
java.sql.SQLException
- if an error occursAbstractRecoveryLog.logRequest(org.objectweb.cjdbc.sql.StoredProcedure,boolean)
public void begin(TransactionMarkerMetaData tm) throws java.sql.SQLException
AbstractRecoveryLog
begin
in class AbstractRecoveryLog
tm
- The transaction marker metadata
java.sql.SQLException
- if an error occursAbstractRecoveryLog.begin(TransactionMarkerMetaData)
public void commit(TransactionMarkerMetaData tm) throws java.sql.SQLException
AbstractRecoveryLog
commit
in class AbstractRecoveryLog
tm
- The transaction marker metadata
java.sql.SQLException
- if an error occursAbstractRecoveryLog.commit(TransactionMarkerMetaData)
public void rollback(TransactionMarkerMetaData tm) throws java.sql.SQLException
AbstractRecoveryLog
rollback
in class AbstractRecoveryLog
tm
- The transaction marker metadata
java.sql.SQLException
- if an error occursAbstractRecoveryLog.rollback(TransactionMarkerMetaData)
public void storeCheckpoint(java.lang.String checkpointName) throws java.sql.SQLException
AbstractRecoveryLog
storeCheckpoint
in class AbstractRecoveryLog
checkpointName
- Name of the checkpoint
java.sql.SQLException
- if an error occursAbstractRecoveryLog.storeCheckpoint(String)
private boolean validCheckpointName(java.lang.String checkpointName) throws java.sql.SQLException
checkpointName
- name of the checkpoint.
java.sql.SQLException
public void storeCheckpoint(java.lang.String checkpointName, int requestId) throws java.sql.SQLException
AbstractRecoveryLog
storeCheckpoint
in class AbstractRecoveryLog
checkpointName
- Name of the checkpointrequestId
- request identifier
java.sql.SQLException
- if an error occursAbstractRecoveryLog.storeCheckpoint(String, int)
private void waitForTransactionsEnd(boolean forceRollback)
public int getCheckpointRequestId(java.lang.String checkpointName) throws java.sql.SQLException
AbstractRecoveryLog
getCheckpointRequestId
in class AbstractRecoveryLog
checkpointName
- Name of the checkpoint
java.sql.SQLException
- if an error occursAbstractRecoveryLog.getCheckpointRequestId(String)
public RecoveryTask recoverNextRequest(int previousRequestId) throws java.sql.SQLException
AbstractRecoveryLog
The id of the request before the first one to recover is given by getCheckpointRequestId.
recoverNextRequest
in class AbstractRecoveryLog
previousRequestId
- id of the previously recovered request
java.sql.SQLException
- if an error occursAbstractRecoveryLog.recoverNextRequest(int)
public void cleanRecoveryLog() throws java.sql.SQLException
cleanRecoveryLog
in class AbstractRecoveryLog
java.sql.SQLException
- if an error occurs.public java.lang.String getXmlInformation()
AbstractRecoveryLog
getXmlInformation
in class AbstractRecoveryLog
AbstractRecoveryLog.getXmlInformation()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |