org.apache.geronimo.transaction.manager
Class TransactionManagerImpl

java.lang.Object
  extended by org.apache.geronimo.transaction.manager.TransactionManagerImpl
All Implemented Interfaces:
EventListener, TransactionManager, UserTransaction, MonitorableTransactionManager, XidImporter
Direct Known Subclasses:
GeronimoTransactionManager, TransactionManagerImplGBean

public class TransactionManagerImpl
extends Object
implements TransactionManager, UserTransaction, XidImporter, MonitorableTransactionManager

Simple implementation of a transaction manager.


Field Summary
protected static int DEFAULT_TIMEOUT
           
protected static byte[] DEFAULT_TM_ID
           
 
Constructor Summary
TransactionManagerImpl()
           
TransactionManagerImpl(int defaultTransactionTimeoutSeconds)
           
TransactionManagerImpl(int defaultTransactionTimeoutSeconds, TransactionLog transactionLog)
           
TransactionManagerImpl(int defaultTransactionTimeoutSeconds, XidFactory xidFactory, TransactionLog transactionLog, Collection resourceManagers)
           
 
Method Summary
 void addTransactionAssociationListener(TransactionManagerMonitor listener)
           
 void begin()
           
 Transaction begin(long transactionTimeoutMilliseconds)
           
 void commit()
           
 void commit(Transaction tx, boolean onePhase)
           
protected  void fireThreadAssociated(Transaction tx)
           
protected  void fireThreadUnassociated(Transaction tx)
           
 void forget(Transaction tx)
           
 Map getExternalXids()
           
 Object getResource(Object key)
           
 boolean getRollbackOnly()
           
 int getStatus()
           
 Transaction getTransaction()
           
 Object getTransactionKey()
           
 int getTransactionStatus()
           
 Transaction importXid(Xid xid, long transactionTimeoutMilliseconds)
           
 int prepare(Transaction tx)
           
 void putResource(Object key, Object value)
           
protected  void recoverResourceManager(ResourceManager resourceManager)
           
 void registerInterposedSynchronization(Synchronization synchronization)
          jta 1.1 method so the jpa implementations can be told to flush their caches.
 void removeTransactionAssociationListener(TransactionManagerMonitor listener)
           
 void resume(Transaction tx)
           
 void rollback()
           
 void rollback(Transaction tx)
           
 void setRollbackOnly()
           
 void setTransactionTimeout(int seconds)
           
 Transaction suspend()
           
protected  List watchResourceManagers(Collection resourceManagers)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIMEOUT

protected static final int DEFAULT_TIMEOUT
See Also:
Constant Field Values

DEFAULT_TM_ID

protected static final byte[] DEFAULT_TM_ID
Constructor Detail

TransactionManagerImpl

public TransactionManagerImpl()
                       throws XAException
Throws:
XAException

TransactionManagerImpl

public TransactionManagerImpl(int defaultTransactionTimeoutSeconds)
                       throws XAException
Throws:
XAException

TransactionManagerImpl

public TransactionManagerImpl(int defaultTransactionTimeoutSeconds,
                              TransactionLog transactionLog)
                       throws XAException
Throws:
XAException

TransactionManagerImpl

public TransactionManagerImpl(int defaultTransactionTimeoutSeconds,
                              XidFactory xidFactory,
                              TransactionLog transactionLog,
                              Collection resourceManagers)
                       throws XAException
Throws:
XAException
Method Detail

watchResourceManagers

protected List watchResourceManagers(Collection resourceManagers)

getTransaction

public Transaction getTransaction()
Specified by:
getTransaction in interface TransactionManager

setTransactionTimeout

public void setTransactionTimeout(int seconds)
                           throws SystemException
Specified by:
setTransactionTimeout in interface TransactionManager
Specified by:
setTransactionTimeout in interface UserTransaction
Throws:
SystemException

getStatus

public int getStatus()
              throws SystemException
Specified by:
getStatus in interface TransactionManager
Specified by:
getStatus in interface UserTransaction
Throws:
SystemException

begin

public void begin()
           throws NotSupportedException,
                  SystemException
Specified by:
begin in interface TransactionManager
Specified by:
begin in interface UserTransaction
Throws:
NotSupportedException
SystemException

begin

public Transaction begin(long transactionTimeoutMilliseconds)
                  throws NotSupportedException,
                         SystemException
Throws:
NotSupportedException
SystemException

suspend

public Transaction suspend()
                    throws SystemException
Specified by:
suspend in interface TransactionManager
Throws:
SystemException

resume

public void resume(Transaction tx)
            throws IllegalStateException,
                   InvalidTransactionException,
                   SystemException
Specified by:
resume in interface TransactionManager
Throws:
IllegalStateException
InvalidTransactionException
SystemException

getResource

public Object getResource(Object key)

getRollbackOnly

public boolean getRollbackOnly()

getTransactionKey

public Object getTransactionKey()

getTransactionStatus

public int getTransactionStatus()

putResource

public void putResource(Object key,
                        Object value)

registerInterposedSynchronization

public void registerInterposedSynchronization(Synchronization synchronization)
jta 1.1 method so the jpa implementations can be told to flush their caches.

Parameters:
synchronization -

setRollbackOnly

public void setRollbackOnly()
                     throws IllegalStateException
Specified by:
setRollbackOnly in interface TransactionManager
Specified by:
setRollbackOnly in interface UserTransaction
Throws:
IllegalStateException

commit

public void commit()
            throws HeuristicMixedException,
                   HeuristicRollbackException,
                   IllegalStateException,
                   RollbackException,
                   SecurityException,
                   SystemException
Specified by:
commit in interface TransactionManager
Specified by:
commit in interface UserTransaction
Throws:
HeuristicMixedException
HeuristicRollbackException
IllegalStateException
RollbackException
SecurityException
SystemException

rollback

public void rollback()
              throws IllegalStateException,
                     SecurityException,
                     SystemException
Specified by:
rollback in interface TransactionManager
Specified by:
rollback in interface UserTransaction
Throws:
IllegalStateException
SecurityException
SystemException

importXid

public Transaction importXid(Xid xid,
                             long transactionTimeoutMilliseconds)
                      throws XAException,
                             SystemException
Specified by:
importXid in interface XidImporter
Throws:
XAException
SystemException

commit

public void commit(Transaction tx,
                   boolean onePhase)
            throws XAException
Specified by:
commit in interface XidImporter
Throws:
XAException

forget

public void forget(Transaction tx)
            throws XAException
Specified by:
forget in interface XidImporter
Throws:
XAException

prepare

public int prepare(Transaction tx)
            throws XAException
Specified by:
prepare in interface XidImporter
Throws:
XAException

rollback

public void rollback(Transaction tx)
              throws XAException
Specified by:
rollback in interface XidImporter
Throws:
XAException

recoverResourceManager

protected void recoverResourceManager(ResourceManager resourceManager)

getExternalXids

public Map getExternalXids()
Specified by:
getExternalXids in interface XidImporter

addTransactionAssociationListener

public void addTransactionAssociationListener(TransactionManagerMonitor listener)
Specified by:
addTransactionAssociationListener in interface MonitorableTransactionManager

removeTransactionAssociationListener

public void removeTransactionAssociationListener(TransactionManagerMonitor listener)
Specified by:
removeTransactionAssociationListener in interface MonitorableTransactionManager

fireThreadAssociated

protected void fireThreadAssociated(Transaction tx)

fireThreadUnassociated

protected void fireThreadUnassociated(Transaction tx)


Copyright © 2006 Apache Software Foundation. All Rights Reserved.