com.caucho.transaction
Class TransactionManagerImpl

java.lang.Object
  extended by com.caucho.transaction.TransactionManagerImpl
All Implemented Interfaces:
java.io.Serializable, TransactionManager

public class TransactionManagerImpl
extends java.lang.Object
implements TransactionManager, java.io.Serializable

Implementation of the transaction manager.

See Also:
Serialized Form

Constructor Summary
TransactionManagerImpl()
           
 
Method Summary
 void begin()
          Create a new transaction and associate it with the thread.
 void commit()
          Commit the transaction.
 void destroy()
          Handles the case where a class loader is dropped.
 void flush()
          Flushes the log stream (primarily for QA).
 TransactionImpl getCurrent()
          Returns the current TransactionImpl, creating if necessary.
static TransactionManagerImpl getInstance()
          Returns the local transaction manager.
static TransactionManagerImpl getLocal()
          Returns the local transaction manager.
 int getStatus()
          Returns the transaction's status
 TransactionSynchronizationRegistry getSyncRegistry()
          Returns the synchronization registry
 long getTimeout()
          Gets the timeout.
 TransactionImpl getTransaction()
          Returns the transaction for the current thread.
 void recover(XAResource xaRes)
          Returns the corresponding user transaction.
 void resume(Transaction tobj)
          Resume the transaction.
 void rollback()
          Rollback the transaction.
 void setRollbackOnly()
          Force any completion to be a rollback.
 void setRollbackOnly(java.lang.Exception e)
          Force any completion to be a rollback.
 void setTimeout(Period timeout)
          Sets the timeout.
 void setTransactionTimeout(int seconds)
          sets the timeout for the transaction
 void setXALogManager(AbstractXALogManager xaLogManager)
          Sets the XA log manager.
 Transaction suspend()
          Suspend the transaction.
 void testClear()
          Clearing for test purposes.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TransactionManagerImpl

public TransactionManagerImpl()
Method Detail

getInstance

public static TransactionManagerImpl getInstance()
Returns the local transaction manager.


getLocal

public static TransactionManagerImpl getLocal()
Returns the local transaction manager.


setTimeout

public void setTimeout(Period timeout)
Sets the timeout.


getTimeout

public long getTimeout()
Gets the timeout.


setXALogManager

public void setXALogManager(AbstractXALogManager xaLogManager)
Sets the XA log manager.


getSyncRegistry

public TransactionSynchronizationRegistry getSyncRegistry()
Returns the synchronization registry


begin

public void begin()
           throws NotSupportedException,
                  SystemException
Create a new transaction and associate it with the thread.

Specified by:
begin in interface TransactionManager
Throws:
NotSupportedException
SystemException

getTransaction

public TransactionImpl getTransaction()
Returns the transaction for the current thread.

Specified by:
getTransaction in interface TransactionManager

suspend

public Transaction suspend()
                    throws SystemException
Suspend the transaction.

Specified by:
suspend in interface TransactionManager
Throws:
SystemException

resume

public void resume(Transaction tobj)
            throws InvalidTransactionException,
                   SystemException
Resume the transaction.

Specified by:
resume in interface TransactionManager
Throws:
InvalidTransactionException
SystemException

setRollbackOnly

public void setRollbackOnly()
                     throws SystemException
Force any completion to be a rollback.

Specified by:
setRollbackOnly in interface TransactionManager
Throws:
SystemException

setRollbackOnly

public void setRollbackOnly(java.lang.Exception e)
Force any completion to be a rollback.


getStatus

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

Specified by:
getStatus in interface TransactionManager
Throws:
SystemException

setTransactionTimeout

public void setTransactionTimeout(int seconds)
                           throws SystemException
sets the timeout for the transaction

Specified by:
setTransactionTimeout in interface TransactionManager
Throws:
SystemException

commit

public void commit()
            throws RollbackException,
                   HeuristicMixedException,
                   HeuristicRollbackException,
                   SystemException
Commit the transaction.

Specified by:
commit in interface TransactionManager
Throws:
RollbackException
HeuristicMixedException
HeuristicRollbackException
SystemException

rollback

public void rollback()
Rollback the transaction.

Specified by:
rollback in interface TransactionManager

getCurrent

public TransactionImpl getCurrent()
Returns the current TransactionImpl, creating if necessary.

The TransactionImpl is not an official externally visible Transaction if the status == NO_TRANSACTION.


recover

public void recover(XAResource xaRes)
             throws XAException
Returns the corresponding user transaction.

Throws:
XAException

flush

public void flush()
Flushes the log stream (primarily for QA).


destroy

public void destroy()
Handles the case where a class loader is dropped.


testClear

public void testClear()
Clearing for test purposes.


toString

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