Class TransactionController


  • public final class TransactionController
    extends java.lang.Object
    TransactionController is used to begin, commit and rollback local transactions
    Author:
    Ludovic Orban
    • Method Detail

      • getDefaultTransactionTimeout

        public int getDefaultTransactionTimeout()
        Get the default transaction timeout in seconds
        Returns:
        the default transaction timeout
      • setDefaultTransactionTimeout

        public void setDefaultTransactionTimeout​(int defaultTransactionTimeoutSeconds)
        Set the default transaction timeout in seconds, it must be > 0
        Parameters:
        defaultTransactionTimeoutSeconds - the default transaction timeout
      • begin

        public void begin()
        Begin a new transaction and bind its context to the current thread
      • begin

        public void begin​(int transactionTimeoutSeconds)
        Begin a new transaction with the specified timeout and bind its context to the current thread
        Parameters:
        transactionTimeoutSeconds - the timeout foe this transaction in seconds
      • commit

        public void commit()
        Commit the transaction bound to the current thread
      • commit

        public void commit​(boolean ignoreTimeout)
        Commit the transaction bound to the current thread, ignoring if the transaction timed out
        Parameters:
        ignoreTimeout - true if the transaction should be committed no matter if it timed out or not
      • rollback

        public void rollback()
        Rollback the transaction bound to the current thread
      • setRollbackOnly

        public void setRollbackOnly()
        Mark the transaction bound to the current thread for rollback only
      • getCurrentTransactionContext

        public LocalTransactionContext getCurrentTransactionContext()
        Get the transaction context bond to the current thread
        Returns:
        the transaction context bond to the current thread or null if no transaction started on the current thread
      • getTransactionCommittedCount

        public long getTransactionCommittedCount()
        Get the committed transactions count
        Returns:
        the committed transactions count
      • getTransactionRolledBackCount

        public long getTransactionRolledBackCount()
        Get the rolled back transactions count
        Returns:
        the rolled back transactions count
      • getTransactionTimedOutCount

        public long getTransactionTimedOutCount()
        Get the timed out transactions count. Note that only transactions which failed to commit due to a timeout are taken into account
        Returns:
        the timed out transactions count
      • getRecoveryManager

        public LocalRecoveryManager getRecoveryManager()
        Get the local transactions recovery manager of this cache manager
        Returns:
        the local transactions recovery manager