com.caucho.transaction
Class UserTransactionImpl

java.lang.Object
  extended by com.caucho.transaction.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 delistResource(ManagedResource resource)
          Delist a resource.
 void enlistResource(ManagedResource resource)
          Enlist a resource.
 int getEnlistedResourceCount()
          Returns the number of currently enlisted resources.
 int getStatus()
          Gets the transaction's status
 java.util.ArrayList<ManagedXAResource> getXaResources()
           
 Xid getXid()
          Returns the XID.
 boolean isActive()
           
 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.
 java.lang.String toString()
           
 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, 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.


isActive

public boolean isActive()

enlistResource

public void enlistResource(ManagedResource resource)
                    throws SystemException,
                           RollbackException
Enlist a resource.

Throws:
SystemException
RollbackException

delistResource

public void delistResource(ManagedResource resource)
Delist a resource.


getXaResources

@Module
public java.util.ArrayList<ManagedXAResource> getXaResources()

getXid

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

Throws:
SystemException
RollbackException

getEnlistedResourceCount

public int getEnlistedResourceCount()
                             throws SystemException,
                                    RollbackException
Returns the number of currently enlisted resources.

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object