| |
|
| java.lang.Object jdbm.recman.TransactionManager
TransactionManager | final public class TransactionManager (Code) | | This class manages the transaction log that belongs to every
RecordFile . The transaction log is either clean, or
in progress. In the latter case, the transaction manager
takes care of a roll forward.
Implementation note: this is a proof-of-concept implementation
which hasn't been optimized for speed. For instance, all sorts
of streams are created for every transaction.
|
Inner Class :public static class BlockIoComparator implements Comparator | |
Field Summary | |
final static int | DEFAULT_TXNS_IN_LOG By default, we keep 10 transactions in the log file before
synchronizing it with the main database file. | final static String | extension Extension of a log file. |
Method Summary | |
void | add(BlockIo block) Indicates the block is part of the transaction. | void | commit() Commits the transaction to the log file. | void | forceClose() Force closing the file without synchronizing pending transaction data. | public void | setMaximumTransactionsInLog(int maxTxns) Set the maximum number of transactions to record in
the log (and keep in memory) before the log is
synchronized with the main database file. | void | shutdown() Shutdowns the transaction manager. | void | start() Starts a transaction. | public void | synchronizeLog() Synchronize log file data with the main database file. | void | synchronizeLogFromDisk() Use the disk-based transaction log to synchronize the data file. |
DEFAULT_TXNS_IN_LOG | final static int DEFAULT_TXNS_IN_LOG(Code) | | By default, we keep 10 transactions in the log file before
synchronizing it with the main database file.
|
extension | final static String extension(Code) | | Extension of a log file.
|
TransactionManager | TransactionManager(RecordFile owner) throws IOException(Code) | | Instantiates a transaction manager instance. If recovery
needs to be performed, it is done.
Parameters: owner - the RecordFile instance that owns this transaction mgr. |
commit | void commit() throws IOException(Code) | | Commits the transaction to the log file.
|
forceClose | void forceClose() throws IOException(Code) | | Force closing the file without synchronizing pending transaction data.
Used for testing purposes only.
|
setMaximumTransactionsInLog | public void setMaximumTransactionsInLog(int maxTxns) throws IOException(Code) | | Set the maximum number of transactions to record in
the log (and keep in memory) before the log is
synchronized with the main database file.
This method must be called while there are no
pending transactions in the log.
|
shutdown | void shutdown() throws IOException(Code) | | Shutdowns the transaction manager. Resynchronizes outstanding
logs.
|
start | void start() throws IOException(Code) | | Starts a transaction. This can block if all slots have been filled
with full transactions, waiting for the synchronization thread to
clean out slots.
|
synchronizeLog | public void synchronizeLog() throws IOException(Code) | | Synchronize log file data with the main database file.
After this call, the main database file is guaranteed to be
consistent and guaranteed to be the only file needed for
backup purposes.
|
synchronizeLogFromDisk | void synchronizeLogFromDisk() throws IOException(Code) | | Use the disk-based transaction log to synchronize the data file.
Outstanding memory logs are discarded because they are believed
to be inconsistent.
|
|
|
|