Package com.mckoi.database
Class OpenTransactionList
- java.lang.Object
-
- com.mckoi.database.OpenTransactionList
-
final class OpenTransactionList extends java.lang.Object
The list of all currently open transactions. This is a thread safe object that is shared between a TableDataConglomerate and its children MasterDataTableSource objects. It is used for maintaining a list of transactions that are currently open in the system. It also provides various utility methods around the list.This class is thread safe and can safely be accessed by multiple threads. This is so threads accessing table source information as well as conglomerate 'commit' stages can safely access this object.
-
-
Field Summary
Fields Modifier and Type Field Description private long
maximum_commit_id
The maximum commit id of the current list.private long
minimum_commit_id
The minimum commit id of the current list.private java.util.ArrayList
open_transaction_stacks
A list of Error objects created when the transaction is added to the open transactions list.private java.util.ArrayList
open_transactions
The list of open transactions.private TransactionSystem
system
The system that this transaction list is part of.private static boolean
TRACKING
True to enable transaction tracking.
-
Constructor Summary
Constructors Constructor Description OpenTransactionList(TransactionSystem system)
Creates the list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addTransaction(Transaction transaction)
Adds a new open transaction to the list.(package private) int
count()
Returns the number of transactions that are open on the conglomerate.(package private) long
minimumCommitID(Transaction transaction)
Returns the minimum commit id not including the given transaction object.(package private) void
removeTransaction(Transaction transaction)
Removes an open transaction from the list.java.lang.String
toString()
-
-
-
Field Detail
-
TRACKING
private static final boolean TRACKING
True to enable transaction tracking.- See Also:
- Constant Field Values
-
system
private TransactionSystem system
The system that this transaction list is part of.
-
open_transactions
private java.util.ArrayList open_transactions
The list of open transactions. (Transaction).
-
open_transaction_stacks
private java.util.ArrayList open_transaction_stacks
A list of Error objects created when the transaction is added to the open transactions list.
-
minimum_commit_id
private long minimum_commit_id
The minimum commit id of the current list.
-
maximum_commit_id
private long maximum_commit_id
The maximum commit id of the current list.
-
-
Constructor Detail
-
OpenTransactionList
OpenTransactionList(TransactionSystem system)
Creates the list.
-
-
Method Detail
-
addTransaction
void addTransaction(Transaction transaction)
Adds a new open transaction to the list. Transactions must be added in order of commit_id.
-
removeTransaction
void removeTransaction(Transaction transaction)
Removes an open transaction from the list.
-
count
int count()
Returns the number of transactions that are open on the conglomerate.
-
minimumCommitID
long minimumCommitID(Transaction transaction)
Returns the minimum commit id not including the given transaction object. Returns Long.MAX_VALUE if there are no open transactions in the list (not including the given transaction).
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-