Class DefaultTransaction

java.lang.Object
cloud.piranha.transaction.nonxa.DefaultTransaction
All Implemented Interfaces:
Transaction

public class DefaultTransaction
extends java.lang.Object
implements Transaction
The default Transaction.
Author:
Manfred Riem ([email protected])
  • Constructor Summary

    Constructors
    Constructor Description
    DefaultTransaction()
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    void commit()
    Commit the transaction.
    boolean delistResource​(javax.transaction.xa.XAResource xaResource, int flags)
    Delist the resource.
    boolean enlistResource​(javax.transaction.xa.XAResource xaResource)
    Enlist the resource.
    int getStatus()
    Get the status.
    void registerSynchronization​(Synchronization synchronization)
    Register a synchronization.
    void rollback()
    Rollback the transaction.
    void setRollbackOnly()
    Set rollback only.
    void setTimeout​(int timeout)
    Set the timeout.
    void setTransactionManager​(TransactionManager transactionManager)
    Set the transaction manager.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultTransaction

      public DefaultTransaction()
      Constructor.
  • Method Details

    • commit

      public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, java.lang.SecurityException, java.lang.IllegalStateException, SystemException
      Commit the transaction.
      Specified by:
      commit in interface Transaction
      Throws:
      RollbackException - when a rollback error occurs.
      HeuristicMixedException - when the heuristics were mixed.
      HeuristicRollbackException - when a rollback error occurs.
      java.lang.SecurityException - when a security error occurs.
      java.lang.IllegalStateException - when the transaction is not active.
      SystemException - when a serious error occurs.
    • delistResource

      public boolean delistResource​(javax.transaction.xa.XAResource xaResource, int flags) throws java.lang.IllegalStateException, SystemException
      Delist the resource.
      Specified by:
      delistResource in interface Transaction
      Parameters:
      xaResource - the XA resource.
      flags - the flags.
      Returns:
      true when delisted, false otherwise.
      Throws:
      java.lang.IllegalStateException - when the transaction is not active.
      SystemException - when a serious error occurs.
    • enlistResource

      public boolean enlistResource​(javax.transaction.xa.XAResource xaResource) throws RollbackException, java.lang.IllegalStateException, SystemException
      Enlist the resource.
      Specified by:
      enlistResource in interface Transaction
      Parameters:
      xaResource - the XA resource.
      Returns:
      true if enlisted, false otherwise.
      Throws:
      RollbackException - when transaction has already been marked for rollback.
      java.lang.IllegalStateException - when the transaction is not active.
      SystemException - when a serious error occurs.
    • getStatus

      public int getStatus() throws SystemException
      Get the status.
      Specified by:
      getStatus in interface Transaction
      Returns:
      the status.
      Throws:
      SystemException - when a serious error occurs.
    • registerSynchronization

      public void registerSynchronization​(Synchronization synchronization) throws RollbackException, java.lang.IllegalStateException, SystemException
      Register a synchronization.
      Specified by:
      registerSynchronization in interface Transaction
      Parameters:
      synchronization - the synchronization.
      Throws:
      RollbackException - when a rollback error occurs.
      java.lang.IllegalStateException - when the transaction is not active
      SystemException - when a serious error occurs.
    • rollback

      public void rollback() throws java.lang.IllegalStateException, SystemException
      Rollback the transaction.
      Specified by:
      rollback in interface Transaction
      Throws:
      java.lang.IllegalStateException - when the transaction is not active.
      SystemException - when a serious error occurs.
    • setRollbackOnly

      public void setRollbackOnly() throws java.lang.IllegalStateException, SystemException
      Set rollback only.
      Specified by:
      setRollbackOnly in interface Transaction
      Throws:
      java.lang.IllegalStateException - when the transaction is not active.
      SystemException - when a serious error occurs.
    • setTimeout

      public void setTimeout​(int timeout)
      Set the timeout.
      Parameters:
      timeout - the timeout.
    • setTransactionManager

      public void setTransactionManager​(TransactionManager transactionManager)
      Set the transaction manager.
      Parameters:
      transactionManager - the transaction manager.