Interface Transaction

  • All Superinterfaces:
    java.lang.AutoCloseable
    All Known Implementing Classes:
    AbstractTransaction

    public interface Transaction
    extends java.lang.AutoCloseable
    A transaction against a single system, which may include several operations against the system, to be committed as one. Implementations are required to atomically apply changes in the commit step or throw an exception if it fails. Operations are performed in the order they are added.
    Author:
    Ulf Lilleengen, bratseth
    • Method Detail

      • operations

        java.util.List<Transaction.Operation> operations()
        Returns the operations of this. Ownership of the returned list is transferred to the caller. The ist may be ready only.
      • prepare

        void prepare()
        Checks whether or not the transaction is able to commit in its current state and do any transient preparatory work to commit.
        Throws:
        java.lang.IllegalStateException - if the transaction cannot be committed
      • commit

        void commit()
        Commit this transaction. If this method returns, all operations in this transaction was committed successfully. Implementations of this must be exception safe or log a message of type severe if they partially alter state.
        Throws:
        java.lang.IllegalStateException - if transaction failed.
      • rollbackOrLog

        void rollbackOrLog()
        This is called if the transaction should be rolled back after commit. If a rollback is not possible or supported. This must log a message of type severe with detailed information about the resulting state.
      • close

        void close()
        Closes and frees any resources allocated by this transaction. The transaction instance cannot be reused once closed.
        Specified by:
        close in interface java.lang.AutoCloseable