public abstract class DBTransaction extends AbstractTransaction implements DBTransactionMBean
Be Careful, the configuration properties don't work for the transaction component: these properties are saved in the transaction repository so they can not be used to configure it.
Transaction
,
MySQLDBTransaction
,
DerbyDBTransaction
AbstractTransaction.Context
Modifier and Type | Field and Description |
---|---|
protected Connection |
conn |
private PreparedStatement |
deleteStmt |
private PreparedStatement |
insertStmt |
(package private) static int |
LogThresholdOperation
Number of pooled operation, by default 1000.
|
private PreparedStatement |
updateStmt |
dir, OOS_STREAM_HEADER, perThreadContext, phase, startTime
logmon
Constructor and Description |
---|
DBTransaction() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the transaction module.
|
void |
commit(boolean release)
Commit the current transaction.
|
void |
delete(String dirName,
String name)
Deletes the specified object.
|
(package private) String |
fname(String dirName,
String name) |
String[] |
getList(String prefix)
Returns an array of strings naming the persistent objects denoted by
a name that satisfy the specified prefix.
|
int |
getLogThresholdOperation()
Returns the pool size for
operation objects, by default 1000. |
String |
getPersistenceDir()
Returns the path of persistence directory.
|
protected abstract void |
initDB()
Instantiates the database driver and creates the table if necessary
|
void |
initRepository() |
boolean |
isPersistent()
Tests if the Transaction component is persistent.
|
byte[] |
loadByteArray(String dirName,
String name)
Load the specified byte array.
|
protected void |
saveInLog(byte[] buf,
String dirName,
String name,
Hashtable log,
boolean copy,
boolean first)
Register the specified object in transaction log.
|
protected void |
setPhase(int newPhase)
Changes the transaction state.
|
void |
stop()
Stops the transaction module.
|
begin, containsOperations, create, create, createByteArray, createByteArray, delete, getOperationCount, getPhase, getPhaseInfo, getStartTime, init, load, load, loadByteArray, release, save, save, save, saveByteArray, saveByteArray, saveByteArray
getBoolean, getInteger, getInteger, getProperty, getProperty, loadProperties, saveProperties
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPhase, getPhaseInfo
getStartTime
static int LogThresholdOperation
DBLogThresholdOperation
specific property.
This property can be fixed only from java
launching
command, or through System.property method.
protected Connection conn
private PreparedStatement insertStmt
private PreparedStatement updateStmt
private PreparedStatement deleteStmt
public int getLogThresholdOperation()
operation
objects, by default 1000.getLogThresholdOperation
in interface DBTransactionMBean
operation
objects.public void initRepository() throws IOException
initRepository
in class AbstractTransaction
IOException
protected abstract void initDB() throws IOException
IOException
public String getPersistenceDir()
protected final void setPhase(int newPhase)
AbstractTransaction
setPhase
in class AbstractTransaction
newPhase
- the new transaction state.public final String[] getList(String prefix)
getList
in interface Transaction
prefix
- the prefixpublic boolean isPersistent()
isPersistent
in interface Transaction
isPersistent
in interface TransactionMBean
protected final void saveInLog(byte[] buf, String dirName, String name, Hashtable log, boolean copy, boolean first) throws IOException
AbstractTransaction
saveInLog
in class AbstractTransaction
buf
- the byte array containing the state of the object.dirName
- the directory name of the object.name
- the name of the object.log
- the log to use.copy
- the byte array can be modified, copy it.first
- the object is a new one.IOException
public byte[] loadByteArray(String dirName, String name) throws IOException
Transaction
loadByteArray
in interface Transaction
dirName
- the directory name of the object.name
- the name of the object.IOException
public void delete(String dirName, String name)
Transaction
delete
in interface Transaction
dirName
- the directory name of the object.name
- the name of the object.public final void commit(boolean release) throws IOException
Transaction
commit
in interface Transaction
release
- if true releases the transaction at the end of the commit.IOException
public void stop()
stop
in interface Transaction
public void close()
close
in interface Transaction
Copyright © 2016 ScalAgent D.T.. All Rights Reserved.