org.apache.geronimo.transaction.manager
Class TransactionManagerImpl

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

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

Simple implementation of a transaction manager.

Version:
$Rev: 727065 $ $Date: 2008-12-16 10:22:22 -0500 (Tue, 16 Dec 2008) $

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)
           
 
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)
           
 long getActiveCount()
          Returns the number of active transactions.
 Map getExternalXids()
           
 Object getResource(Object key)
           
 boolean getRollbackOnly()
           
 int getStatus()
           
 long getTotalCommits()
          Return the number of total commits
 long getTotalRollbacks()
          Returns the number of total rollbacks
 Transaction getTransaction()
           
 Object getTransactionKey()
           
 int getTransactionStatus()
           
 Transaction importXid(Xid xid, long transactionTimeoutMilliseconds)
           
 int prepare(Transaction tx)
           
 void putResource(Object key, Object value)
           
 void recoverResourceManager(NamedXAResource xaResource)
           
 void recoveryError(Exception e)
           
 void registerInterposedSynchronization(Synchronization synchronization)
          jta 1.1 method so the jpa implementations can be told to flush their caches.
 void removeTransactionAssociationListener(TransactionManagerMonitor listener)
           
 void resetStatistics()
          Reset statistics
 void resume(Transaction tx)
           
 void rollback()
           
 void rollback(Transaction tx)
           
 void setRollbackOnly()
           
 void setTransactionTimeout(int seconds)
           
 Transaction suspend()
           
 
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)
                       throws XAException
Throws:
XAException
Method Detail

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)
Specified by:
getResource in interface TransactionSynchronizationRegistry

getRollbackOnly

public boolean getRollbackOnly()
Specified by:
getRollbackOnly in interface TransactionSynchronizationRegistry

getTransactionKey

public Object getTransactionKey()
Specified by:
getTransactionKey in interface TransactionSynchronizationRegistry

getTransactionStatus

public int getTransactionStatus()
Specified by:
getTransactionStatus in interface TransactionSynchronizationRegistry

putResource

public void putResource(Object key,
                        Object value)
Specified by:
putResource in interface TransactionSynchronizationRegistry

registerInterposedSynchronization

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

Specified by:
registerInterposedSynchronization in interface TransactionSynchronizationRegistry
Parameters:
synchronization -

setRollbackOnly

public void setRollbackOnly()
                     throws IllegalStateException
Specified by:
setRollbackOnly in interface TransactionManager
Specified by:
setRollbackOnly in interface TransactionSynchronizationRegistry
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

recoveryError

public void recoveryError(Exception e)
Specified by:
recoveryError in interface RecoverableTransactionManager

recoverResourceManager

public void recoverResourceManager(NamedXAResource xaResource)
Specified by:
recoverResourceManager in interface RecoverableTransactionManager

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)

getActiveCount

public long getActiveCount()
Returns the number of active transactions.


getTotalCommits

public long getTotalCommits()
Return the number of total commits


getTotalRollbacks

public long getTotalRollbacks()
Returns the number of total rollbacks


resetStatistics

public void resetStatistics()
Reset statistics



Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.