|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjavax.management.StandardMBean
org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean
org.objectweb.cjdbc.controller.recoverylog.AbstractRecoveryLog
org.objectweb.cjdbc.controller.recoverylog.JDBCRecoveryLog
Recovery Log using a database accessed through JDBC.
| Nested Class Summary |
| Nested classes inherited from class javax.management.StandardMBean |
|
| Field Summary | |
private java.lang.String |
backendTableCreateStatement
Backend table |
private java.lang.String |
backendTableName
|
private java.lang.String |
checkextraStatement
|
private java.lang.String |
checkpointTableCreateStatement
|
private java.lang.String |
checkpointTableName
Checkpoint table name. |
private java.sql.Connection |
connection
Connection to the database. |
private java.lang.String |
driverClassName
Driver class name. |
private java.lang.String |
driverName
Driver name. |
private java.lang.String |
idType
|
private java.lang.String |
logextraStatement
|
private JDBCLoggerThread |
loggerThread
|
private java.lang.String |
login
User's login. |
private java.lang.String |
logTableCreateStatement
|
private long |
logTableId
Current maximum value of the primary key in logTableName. |
private java.lang.String |
logTableName
Name of the log table. |
private java.lang.String |
nameType
|
private java.lang.String |
password
User's password. |
private java.sql.PreparedStatement |
pstmt
PreparedStatement used to log requests. |
private java.lang.String |
requestIdType
|
private java.lang.String |
sqlColumnName
|
private java.lang.String |
sqlType
|
private int |
timeout
Timeout for SQL requests. |
private java.lang.String |
transactionIdType
|
private java.lang.String |
url
Driver URL. |
private java.lang.String |
vloginType
|
| Fields inherited from class org.objectweb.cjdbc.controller.recoverylog.AbstractRecoveryLog |
logger |
| Fields inherited from class org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean |
|
| Fields inherited from class javax.management.StandardMBean |
|
| Fields inherited from interface org.objectweb.cjdbc.common.xml.XmlComponent |
DOCTYPE_DB, XML_VERSION |
| Constructor Summary | |
JDBCRecoveryLog(java.lang.String driverName,
java.lang.String driverClassName,
java.lang.String url,
java.lang.String login,
java.lang.String password,
int requestTimeout)
Creates a new JDBCRecoveryLog instance. |
|
| Method Summary | |
void |
abort(TransactionMarkerMetaData tm)
Log a transaction abort. |
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. |
void |
commit(TransactionMarkerMetaData tm)
Log a transaction commit. |
private void |
connectToDatabase()
Gets a connection to the database. |
java.lang.String |
getAssociatedString()
Allow to retrieve internationalization description on mbeans as well |
BackendRecoveryInfo |
getBackendInfo(java.lang.String databaseName,
java.lang.String backendName)
Retrieve recovery information on a backend. |
java.lang.String |
getBackendTableName()
Returns the backendTableName value. |
java.util.ArrayList |
getCheckpointNames()
Returns an array of names of all the checkpoint available in the recovery log |
long |
getCheckpointRequestId(java.lang.String checkpointName)
Get the request id corresponding to a given checkpoint. |
java.lang.String |
getCheckpointTableName()
Returns the checkpointTableName value. |
java.lang.String[][] |
getData()
Allow to get the content of the recovery log for viewing |
long |
getLastTransactionId()
Get the id of the last transaction logged in the recovery log. |
java.lang.String |
getLogTableName()
Returns the logTableName value. |
java.lang.String |
getXmlImpl()
|
private long |
incrementLogTableId()
Increments the value of logTableId. |
private void |
intializeDatabase()
Checks if the tables (log and checkpoint) already exist, and create them if needed. |
void |
logRequest(AbstractWriteRequest request)
Log a write request. |
void |
logRequest(StoredProcedure proc,
boolean isRead)
Log a call to a stored procedure. |
RecoveryTask |
recoverNextRequest(long previousRequestId)
Get the next request (begin/commit/rollback or WriteRequest) from the recovery log given the id of the previously recovered request. |
private java.lang.String |
recreateSkeleton(java.lang.String sql)
Recreate the skeleton of the query from the query itself with the param tag |
void |
removeCheckpoint(java.lang.String checkpointName)
Remove a checkpoint from the recovery. |
void |
rollback(TransactionMarkerMetaData tm)
Log a transaction rollback. |
void |
setBackendTableCreateStatement(java.lang.String tableName,
java.lang.String checkpointNameType,
java.lang.String backendNameType,
java.lang.String backendStateType,
java.lang.String databaseNameType,
java.lang.String extraStatement)
Sets the backend table create statement |
void |
setCheckpointTableCreateStatement(java.lang.String tableName,
java.lang.String nameType,
java.lang.String requestIdType,
java.lang.String extraStatement)
Sets the checkpoint table name and create statement. |
private void |
setDriverProcessedAndSkeleton(AbstractRequest request)
Set the driverProcessed flag of the given request according to its SQL content and rebuild the SQL skeleton if necessary. |
void |
setLogTableCreateStatement(java.lang.String tableName,
java.lang.String idType,
java.lang.String vloginType,
java.lang.String sqlName,
java.lang.String sqlType,
java.lang.String transactionIdType,
java.lang.String extraStatement)
Sets the log table name and create statement. |
void |
storeBackendInfo(java.lang.String databaseName,
java.lang.String backendName,
java.lang.String checkpoint,
int state)
Store the state of the backend in the recovery log |
void |
storeCheckpoint(java.lang.String checkpointName)
Store a Checkpoint using the current log state. |
void |
storeCheckpoint(java.lang.String checkpointName,
long 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, getRecoveringNb, getXml, isRecovering |
| Methods inherited from class org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean |
addNotificationListener, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getNotificationInfo, getParameterName, getParameterName, removeNotificationListener, removeNotificationListener, sendNotification |
| Methods inherited from class javax.management.StandardMBean |
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, invoke, setAttribute, setAttributes, setImplementation |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.objectweb.cjdbc.common.jmx.mbeans.AbstractRecoveryLogMBean |
getRecoveringNb, isRecovering |
| Field Detail |
private java.lang.String driverClassName
private java.lang.String driverName
private java.lang.String url
private java.lang.String login
private java.lang.String password
private java.lang.String logTableName
private java.lang.String logTableCreateStatement
private java.lang.String idType
private java.lang.String vloginType
private java.lang.String sqlType
private java.lang.String transactionIdType
private java.lang.String logextraStatement
private java.lang.String checkpointTableName
private java.lang.String checkpointTableCreateStatement
private java.lang.String backendTableCreateStatement
#setBackendTableCreateStatement()private java.lang.String backendTableName
private java.lang.String nameType
private java.lang.String requestIdType
private java.lang.String checkextraStatement
private java.sql.Connection connection
private java.sql.PreparedStatement pstmt
PreparedStatement used to log requests.
private long logTableId
private int timeout
private JDBCLoggerThread loggerThread
private java.lang.String sqlColumnName
| Constructor Detail |
public JDBCRecoveryLog(java.lang.String driverName,
java.lang.String driverClassName,
java.lang.String url,
java.lang.String login,
java.lang.String password,
int requestTimeout)
throws javax.management.NotCompliantMBeanException
JDBCRecoveryLog instance.
driverName - the driverClassName name.driverClassName - the driverClassName 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.
javax.management.NotCompliantMBeanException - if the MBean is not JMX compliant| Method Detail |
public void checkRecoveryLogTables()
public long getLastTransactionId()
throws java.sql.SQLException
AbstractRecoveryLogMBean
getLastTransactionId in interface AbstractRecoveryLogMBeangetLastTransactionId in class AbstractRecoveryLogjava.sql.SQLException - if an error occured while retrieving the id.AbstractRecoveryLog.getLastTransactionId()
public void setLogTableCreateStatement(java.lang.String tableName,
java.lang.String idType,
java.lang.String vloginType,
java.lang.String sqlName,
java.lang.String sqlType,
java.lang.String transactionIdType,
java.lang.String extraStatement)
tableName - of the log tableidType - of the id columnvloginType - of the login columnsqlName - name of the sql statement columnsqlType - of the sql columntransactionIdType - of the transaction columnextraStatement - like primary keys ...
public void setCheckpointTableCreateStatement(java.lang.String tableName,
java.lang.String nameType,
java.lang.String requestIdType,
java.lang.String extraStatement)
tableName - name of the checkpoint table.nameType - type for the name columnrequestIdType - type for the requestId columnextraStatement - like primary keys
public void setBackendTableCreateStatement(java.lang.String tableName,
java.lang.String checkpointNameType,
java.lang.String backendNameType,
java.lang.String backendStateType,
java.lang.String databaseNameType,
java.lang.String extraStatement)
tableName - the backend table namecheckpointNameType - type for the checkpointName columnbackendNameType - type for the backendName columnbackendStateType - type for the backendState columndatabaseNameType - type for the databaseName columnextraStatement - like primary keysprivate long 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 AbstractRecoveryLogrequest - 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 AbstractRecoveryLogproc - 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.common.sql.StoredProcedure,boolean)
public void begin(TransactionMarkerMetaData tm)
throws java.sql.SQLException
AbstractRecoveryLog
begin in class AbstractRecoveryLogtm - The transaction marker metadata
java.sql.SQLException - if an error occursAbstractRecoveryLog.begin(TransactionMarkerMetaData)
public void abort(TransactionMarkerMetaData tm)
throws java.sql.SQLException
AbstractRecoveryLog
abort in class AbstractRecoveryLogtm - The transaction marker metadata
java.sql.SQLException - if an error occursAbstractRecoveryLog.abort(org.objectweb.cjdbc.controller.requestmanager.TransactionMarkerMetaData)
public void commit(TransactionMarkerMetaData tm)
throws java.sql.SQLException
AbstractRecoveryLog
commit in class AbstractRecoveryLogtm - 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 AbstractRecoveryLogtm - The transaction marker metadata
java.sql.SQLException - if an error occursAbstractRecoveryLog.rollback(TransactionMarkerMetaData)
public void storeCheckpoint(java.lang.String checkpointName)
throws java.sql.SQLException
AbstractRecoveryLogMBean
storeCheckpoint in interface AbstractRecoveryLogMBeanstoreCheckpoint in class AbstractRecoveryLogcheckpointName - 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,
long requestId)
throws java.sql.SQLException
AbstractRecoveryLogMBean
storeCheckpoint in interface AbstractRecoveryLogMBeanstoreCheckpoint in class AbstractRecoveryLogcheckpointName - Name of the checkpointrequestId - request identifier
java.sql.SQLException - if an error occursAbstractRecoveryLog.storeCheckpoint(String,
long)private void waitForTransactionsEnd(boolean forceRollback)
public long getCheckpointRequestId(java.lang.String checkpointName)
throws java.sql.SQLException
AbstractRecoveryLogMBean
getCheckpointRequestId in interface AbstractRecoveryLogMBeangetCheckpointRequestId in class AbstractRecoveryLogcheckpointName - Name of the checkpoint
java.sql.SQLException - if an error occursAbstractRecoveryLog.getCheckpointRequestId(String)
public RecoveryTask recoverNextRequest(long previousRequestId)
throws java.sql.SQLException
AbstractRecoveryLogThe id of the request before the first one to recover is given by getCheckpointRequestId.
recoverNextRequest in class AbstractRecoveryLogpreviousRequestId - id of the previously recovered request
java.sql.SQLException - if an error occursAbstractRecoveryLog.recoverNextRequest(long)private void setDriverProcessedAndSkeleton(AbstractRequest request)
request - Request to processprivate java.lang.String recreateSkeleton(java.lang.String sql)
sql - the sql query as it is recorded in the recovery log
public void cleanRecoveryLog()
throws java.sql.SQLException
cleanRecoveryLog in interface AbstractRecoveryLogMBeancleanRecoveryLog in class AbstractRecoveryLogjava.sql.SQLException - if an error occurs.
public void removeCheckpoint(java.lang.String checkpointName)
throws java.sql.SQLException
AbstractRecoveryLogMBean
removeCheckpoint in interface AbstractRecoveryLogMBeanremoveCheckpoint in class AbstractRecoveryLogcheckpointName - to remove
java.sql.SQLException - if an error occursAbstractRecoveryLog.removeCheckpoint(java.lang.String)
public java.util.ArrayList getCheckpointNames()
throws java.sql.SQLException
AbstractRecoveryLogMBean
getCheckpointNames in interface AbstractRecoveryLogMBeangetCheckpointNames in class AbstractRecoveryLogArrayList of String checkpoint names
java.sql.SQLException - if failsAbstractRecoveryLog.getCheckpointNames()
public void storeBackendInfo(java.lang.String databaseName,
java.lang.String backendName,
java.lang.String checkpoint,
int state)
throws java.sql.SQLException
AbstractRecoveryLogMBean
storeBackendInfo in interface AbstractRecoveryLogMBeanstoreBackendInfo in class AbstractRecoveryLogdatabaseName - name of the virtual databasebackendName - name of the backendcheckpoint - lastknown check point for this backendstate - the state of the backend
java.sql.SQLException - if cannot proceedAbstractRecoveryLog.storeBackendInfo(java.lang.String,
java.lang.String, java.lang.String, int)
public BackendRecoveryInfo getBackendInfo(java.lang.String databaseName,
java.lang.String backendName)
AbstractRecoveryLogMBean
getBackendInfo in interface AbstractRecoveryLogMBeangetBackendInfo in class AbstractRecoveryLogdatabaseName - the virtual database namebackendName - the backend name
BackendRecoveryInfo instance or null if the backend does not exist- See Also:
AbstractRecoveryLog.getBackendInfo(java.lang.String,
java.lang.String)public java.lang.String getXmlImpl()
getXmlImpl in class AbstractRecoveryLogAbstractRecoveryLog.getXmlImpl()public java.lang.String getBackendTableName()
public java.lang.String getCheckpointTableName()
public java.lang.String getLogTableName()
public java.lang.String[][] getData()
AbstractRecoveryLog
getData in class AbstractRecoveryLogString[][]AbstractRecoveryLog.getData()public java.lang.String getAssociatedString()
AbstractStandardMBean
getAssociatedString in class AbstractStandardMBeanAbstractStandardMBean.getAssociatedString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||