Class TransactionsManager
java.lang.Object
com.siperf.amistream.connection.both.transcation.TransactionsManager
- Direct Known Subclasses:
ClientTransactionManager
Manages transactions within a system, providing functionality to update, cancel,
and handle completion of transactions.
This class interacts with the TransactionsTable to manage active transactions
and their states. It also defines an update mechanism that processes each transaction
periodically through the TransactionsManager.TransactionIterationTask.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTransactionsManager(Connection connection) Constructs aTransactionsManagerwith a specified database connection. -
Method Summary
Modifier and TypeMethodDescriptionvoidCancels all active transactions within the manager.protected voidonTransactionComplete(Transaction transaction) Handles the completion of a transaction.voidupdate(long ms) Updates the state of transactions within the manager.
-
Constructor Details
-
TransactionsManager
Constructs aTransactionsManagerwith a specified database connection.This constructor initializes the iteration task used for processing transactions.
- Parameters:
connection- the databaseConnectionused by the manager (currently unused in this class).
-
-
Method Details
-
getTransactionsTable
-
update
public void update(long ms) Updates the state of transactions within the manager. This method is typically called periodically to process transaction updates.It checks for shading transactions and updates all transactions that need updating.
- Parameters:
ms- the time elapsed (in milliseconds) to be used for updating the transactions.
-
onTransactionComplete
Handles the completion of a transaction. This method is invoked when a transaction has been processed and is no longer active.- Parameters:
transaction- the completedTransaction.
-
cancelAllTransactions
public void cancelAllTransactions()Cancels all active transactions within the manager.This method stops all transactions, including the shading transaction, if one exists.
-