Class TransactionsManager

java.lang.Object
com.siperf.amistream.connection.both.transcation.TransactionsManager
Direct Known Subclasses:
ClientTransactionManager

public class TransactionsManager extends Object
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 Details

    • TransactionsManager

      protected TransactionsManager(Connection connection)
      Constructs a TransactionsManager with a specified database connection.

      This constructor initializes the iteration task used for processing transactions.

      Parameters:
      connection - the database Connection used by the manager (currently unused in this class).
  • Method Details

    • getTransactionsTable

      public TransactionsTable 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

      protected void onTransactionComplete(Transaction transaction)
      Handles the completion of a transaction. This method is invoked when a transaction has been processed and is no longer active.
      Parameters:
      transaction - the completed Transaction.
    • cancelAllTransactions

      public void cancelAllTransactions()
      Cancels all active transactions within the manager.

      This method stops all transactions, including the shading transaction, if one exists.