org.openorb.ots.jta
Class Transaction

java.lang.Object
  extended byorg.openorb.ots.jta.Transaction

public class Transaction
extends java.lang.Object

This class represents a transaction. It gives the ability to register or unregister an XA resource, but also the possibility to demarcate a transaction. Restriction : to be able to manage XA resource from this class, it is required to use OpenORB OTS that provides a JTA compatibility ( support of javax.transaction.xa.XAResource )

Author:
Jerome Daniel

Constructor Summary
Transaction(Current curr, org.omg.PortableServer.POA poa, org.omg.CORBA.ORB orb, Logger logger)
          Constructor
 
Method Summary
 void commit()
          Commit the current transaction
 boolean delistResource(javax.transaction.xa.XAResource resource, int flag)
          Delist a resource from the current transaction
 boolean enlistResource(javax.transaction.xa.XAResource resource)
          Enlist a new resource for the current transaction.
 int getStatus()
          Return the transaction status.
 void registerSynchronization(javax.transaction.Synchronization synchro)
          Register a new synchronization object
 void rollback()
          Rollback a transaction
 void setRollbackOnly()
          Set the current transaction to be only rolledback
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transaction

public Transaction(Current curr,
                   org.omg.PortableServer.POA poa,
                   org.omg.CORBA.ORB orb,
                   Logger logger)
Constructor

Method Detail

commit

public void commit()
            throws javax.transaction.RollbackException,
                   javax.transaction.HeuristicMixedException,
                   javax.transaction.HeuristicRollbackException,
                   java.lang.SecurityException,
                   java.lang.IllegalStateException,
                   javax.transaction.SystemException
Commit the current transaction

Throws:
javax.transaction.RollbackException
javax.transaction.HeuristicMixedException
javax.transaction.HeuristicRollbackException
java.lang.SecurityException
java.lang.IllegalStateException
javax.transaction.SystemException

delistResource

public boolean delistResource(javax.transaction.xa.XAResource resource,
                              int flag)
                       throws java.lang.IllegalStateException,
                              javax.transaction.SystemException
Delist a resource from the current transaction

Throws:
java.lang.IllegalStateException
javax.transaction.SystemException

enlistResource

public boolean enlistResource(javax.transaction.xa.XAResource resource)
                       throws javax.transaction.RollbackException,
                              java.lang.IllegalStateException,
                              javax.transaction.SystemException
Enlist a new resource for the current transaction.

Throws:
javax.transaction.RollbackException
java.lang.IllegalStateException
javax.transaction.SystemException

getStatus

public int getStatus()
              throws javax.transaction.SystemException
Return the transaction status.

Throws:
javax.transaction.SystemException

registerSynchronization

public void registerSynchronization(javax.transaction.Synchronization synchro)
                             throws javax.transaction.RollbackException,
                                    java.lang.IllegalStateException,
                                    javax.transaction.SystemException
Register a new synchronization object

Throws:
javax.transaction.RollbackException
java.lang.IllegalStateException
javax.transaction.SystemException

rollback

public void rollback()
              throws java.lang.IllegalStateException,
                     java.lang.SecurityException,
                     javax.transaction.SystemException
Rollback a transaction

Throws:
java.lang.IllegalStateException
java.lang.SecurityException
javax.transaction.SystemException

setRollbackOnly

public void setRollbackOnly()
                     throws java.lang.IllegalStateException,
                            javax.transaction.SystemException
Set the current transaction to be only rolledback

Throws:
java.lang.IllegalStateException
javax.transaction.SystemException