com.caucho.jca
Class UserTransactionImpl

java.lang.Object
  extended by com.caucho.jca.UserTransactionImpl
All Implemented Interfaces:
UserTransaction

public class UserTransactionImpl
extends java.lang.Object
implements UserTransaction

Implementation of the UserTransactionImpl for a thread instance.


Constructor Summary
UserTransactionImpl(TransactionManagerImpl tm)
          Creates the proxy.
 
Method Summary
 void abortTransaction()
          Aborts the transaction.
 void begin()
          Start the transaction.
 void commit()
          Commits the transaction
 void enlistBeginResource(BeginResource resource)
          Enlist a resource automatically called when a transaction begins
 void enlistCloseResource(CloseResource resource)
          Enlist a resource automatically closed when the context ends.
 int getEnlistedResourceCount()
          Returns the XID.
 int getStatus()
          Gets the transaction's status
 Xid getXid()
          Returns the XID.
 boolean isInContext()
          inContext is valid within a managed UserTransactionImpl context, e.g in a webApp, but not in a cron job.
 void rollback()
          Rolls the transaction back
 void setInContext(boolean isInContext)
          inContext is valid within a managed UserTransactionImpl context, e.g in a webApp, but not in a cron job.
 void setRollbackOnly()
          Marks the transaction as rollback only.
 void setRollbackOnly(java.lang.Exception e)
          Marks the transaction as rollback only.
 void setTransactionTimeout(int seconds)
          Sets the transaction's timeout.
 void userResume(UserTransactionSuspendState state)
          Resumes the transaction.
 UserTransactionSuspendState userSuspend()
          Suspends the transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserTransactionImpl

public UserTransactionImpl(TransactionManagerImpl tm)
Creates the proxy.

Method Detail

setTransactionTimeout

public void setTransactionTimeout(int seconds)
                           throws SystemException
Sets the transaction's timeout.

Specified by:
setTransactionTimeout in interface UserTransaction
Throws:
SystemException

getStatus

public int getStatus()
              throws SystemException
Gets the transaction's status

Specified by:
getStatus in interface UserTransaction
Throws:
SystemException

isInContext

public boolean isInContext()
inContext is valid within a managed UserTransactionImpl context, e.g in a webApp, but not in a cron job.


setInContext

public void setInContext(boolean isInContext)
inContext is valid within a managed UserTransactionImpl context, e.g in a webApp, but not in a cron job.


enlistBeginResource

public void enlistBeginResource(BeginResource resource)
Enlist a resource automatically called when a transaction begins


enlistCloseResource

public void enlistCloseResource(CloseResource resource)
Enlist a resource automatically closed when the context ends.


getXid

public Xid getXid()
           throws SystemException,
                  RollbackException
Returns the XID.

Throws:
SystemException
RollbackException

getEnlistedResourceCount

public int getEnlistedResourceCount()
                             throws SystemException,
                                    RollbackException
Returns the XID.

Throws:
SystemException
RollbackException

begin

public void begin()
           throws NotSupportedException,
                  SystemException
Start the transaction.

Specified by:
begin in interface UserTransaction
Throws:
NotSupportedException
SystemException

userSuspend

public UserTransactionSuspendState userSuspend()
Suspends the transaction.


userResume

public void userResume(UserTransactionSuspendState state)
Resumes the transaction.


setRollbackOnly

public void setRollbackOnly()
                     throws java.lang.IllegalStateException,
                            SystemException
Marks the transaction as rollback only.

Specified by:
setRollbackOnly in interface UserTransaction
Throws:
java.lang.IllegalStateException
SystemException

setRollbackOnly

public void setRollbackOnly(java.lang.Exception e)
                     throws java.lang.IllegalStateException
Marks the transaction as rollback only.

Throws:
java.lang.IllegalStateException

commit

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

Specified by:
commit in interface UserTransaction
Throws:
java.lang.IllegalStateException
RollbackException
HeuristicMixedException
HeuristicRollbackException
java.lang.SecurityException
SystemException

rollback

public void rollback()
              throws java.lang.IllegalStateException,
                     java.lang.SecurityException,
                     SystemException
Rolls the transaction back

Specified by:
rollback in interface UserTransaction
Throws:
java.lang.IllegalStateException
java.lang.SecurityException
SystemException

abortTransaction

public void abortTransaction()
                      throws java.lang.IllegalStateException
Aborts the transaction.

Throws:
java.lang.IllegalStateException