Class Transaction


  • public class Transaction
    extends Object
    Simple transaction mechanism for config-api objects
    Author:
    Jerome Dochez
    • Constructor Detail

      • Transaction

        public Transaction()
    • Method Detail

      • rollback

        public void rollback()
        Rollbacks all participants to this transaction.
      • canCommit

        public boolean canCommit()
                          throws TransactionFailure
        Tests if the transaction participants will pass the prepare phase successfully. The prepare phase will invoke validation of the changes, so a positive return usually means the changes are valid and unless a external factor arise, the commit() method will succeed.
        Returns:
        true if the participants changes are valid, false otherwise
        Throws:
        TransactionFailure - if the changes are not valid
      • getTransaction

        public static <T extends ConfigBeanProxyTransaction getTransaction​(T source)
        Returns the transaction associated with a writable view
        Parameters:
        source - the proxy to the writable view
        Returns:
        the transaction object for that view or null if not transaction is in progress
      • enroll

        public <T extends ConfigBeanProxy> T enroll​(T source)
                                             throws TransactionFailure
        Enroll a configuration object in a transaction and returns a writeable view of it
        Parameters:
        source - the configured interface implementation
        Returns:
        the new interface implementation providing write access
        Throws:
        TransactionFailure - if the object cannot be enrolled (probably already enrolled in another transaction).