org.objectweb.jonas.jtm.jotm
Class JOTMTransactionService

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.objectweb.jonas.management.reconfig.emitter.ReconfigEmitter
          extended by org.objectweb.jonas.service.AbsServiceImpl
              extended by org.objectweb.jonas.jtm.jotm.JOTMTransactionService
All Implemented Interfaces:
NotificationBroadcaster, NotificationEmitter, TransactionService, Service

public class JOTMTransactionService
extends AbsServiceImpl
implements TransactionService

Transaction Service implementation. This singleton class must exist in each jonas server. This class manages a unique Current object that implements both TransactionManager and UserTransaction interfaces.

Author:
Philippe Durieux Contributor(s): Adriana Danes

Field Summary
static String SERVICE_NAME
          Service name as used to label configuration properties
 
Fields inherited from class org.objectweb.jonas.management.reconfig.emitter.ReconfigEmitter
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Constructor Summary
JOTMTransactionService()
           
 
Method Summary
 void attachTransaction(Xid xid, long timeout)
          Attach the current calling Thread to the given Xid.
 int commitXAResource(String xatx)
           
 void detachTransaction()
          Detach the current Thread of the running Transaction.
 void doInit(Context ctx)
          Init the Service.
 void doStart()
          Start the Service Initialization of the service is already done.
 void doStop()
          Stop the transaction service Not already implementated
 int forgetXAResource(String xatx)
           
 String[] getAllActiveTx()
          Get all currently executing transactions
 Xid[] getAllActiveXids()
          Get all currently executing Xids
 String[] getAllRecoveryTx()
          Get all transactions that require administrator recovery action
 String[] getAllXAResource(String xtx)
          Get all XAResoures of a transaction that require administrator recovery action
 org.objectweb.jotm.Current getCurrent()
          Gets the Current object instance
 int getTimeout()
           
 int getTotalBegunTransactions()
          Get begun transactions number
 int getTotalCommittedTransactions()
          Get committed transactions number
 int getTotalCurrentTransactions()
          Get current transactions number
 int getTotalExpiredTransactions()
          Get expired transactions number
 int getTotalRolledbackTransactions()
          Get rollebacked transactions number
 org.objectweb.jotm.TransactionFactory getTransactionFactory()
          Gets the TransactionFactory object (JTM factory)
 org.objectweb.transaction.jta.TransactionManager getTransactionManager()
          Gets the TransactionManager object instance
 UserTransaction getUserTransaction()
          Gets the UserTransaction object instance
 void resetAllTxTotalCounters()
          Reset all transaction counters
 int rollbackXAResource(String xatx)
           
 void setTimeout(int t)
          Sets the default transaction timeout and register Current in JNDI
 
Methods inherited from class org.objectweb.jonas.service.AbsServiceImpl
getDomainName, getJonasServerName, getName, init, isStarted, setName, start, stop
 
Methods inherited from class org.objectweb.jonas.management.reconfig.emitter.ReconfigEmitter
initLogger, sendReconfigNotification, sendSaveNotification
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jonas.service.Service
getName, init, isStarted, setName, start, stop
 

Field Detail

SERVICE_NAME

public static final String SERVICE_NAME
Service name as used to label configuration properties

See Also:
Constant Field Values
Constructor Detail

JOTMTransactionService

public JOTMTransactionService()
Method Detail

doInit

public void doInit(Context ctx)
            throws ServiceException
Init the Service. Configuration information is passed thru a Context object.

Specified by:
doInit in class AbsServiceImpl
Parameters:
ctx - naming context containing configuration parameters
Throws:
ServiceException - if service initialization failes

doStart

public void doStart()
             throws ServiceException
Start the Service Initialization of the service is already done.

Specified by:
doStart in class AbsServiceImpl
Throws:
ServiceException - if service start fails

doStop

public void doStop()
            throws ServiceException
Stop the transaction service Not already implementated

Specified by:
doStop in class AbsServiceImpl
Throws:
ServiceException - if the service stop fails

getCurrent

public org.objectweb.jotm.Current getCurrent()
Gets the Current object instance

Specified by:
getCurrent in interface TransactionService
Returns:
the current object

getTransactionManager

public org.objectweb.transaction.jta.TransactionManager getTransactionManager()
Gets the TransactionManager object instance

Specified by:
getTransactionManager in interface TransactionService
Returns:
the transaction manager

getUserTransaction

public UserTransaction getUserTransaction()
Gets the UserTransaction object instance

Specified by:
getUserTransaction in interface TransactionService
Returns:
the user transaction object

getTransactionFactory

public org.objectweb.jotm.TransactionFactory getTransactionFactory()
Gets the TransactionFactory object (JTM factory)

Specified by:
getTransactionFactory in interface TransactionService
Returns:
the transaction factory (JTM object)

getTimeout

public int getTimeout()

setTimeout

public void setTimeout(int t)
Sets the default transaction timeout and register Current in JNDI

Specified by:
setTimeout in interface TransactionService
Parameters:
t - new value for time-out

getTotalBegunTransactions

public int getTotalBegunTransactions()
Get begun transactions number

Returns:
total number of begun transactions

getTotalCommittedTransactions

public int getTotalCommittedTransactions()
Get committed transactions number

Returns:
total number of committed transactions

getTotalCurrentTransactions

public int getTotalCurrentTransactions()
Get current transactions number

Returns:
total number of current transactions

getTotalExpiredTransactions

public int getTotalExpiredTransactions()
Get expired transactions number

Returns:
total number of expired transactions

getTotalRolledbackTransactions

public int getTotalRolledbackTransactions()
Get rollebacked transactions number

Returns:
total number of rollbacked transactions

resetAllTxTotalCounters

public void resetAllTxTotalCounters()
Reset all transaction counters


getAllActiveXids

public Xid[] getAllActiveXids()
Get all currently executing Xids

Returns:
total number of executing Xids

getAllActiveTx

public String[] getAllActiveTx()
Get all currently executing transactions

Returns:
total number of executing transaction

getAllRecoveryTx

public String[] getAllRecoveryTx()
Get all transactions that require administrator recovery action

Returns:
Transactions that require administrator recovery action

getAllXAResource

public String[] getAllXAResource(String xtx)
Get all XAResoures of a transaction that require administrator recovery action

Returns:
XAResources that require administrator recovery action

commitXAResource

public int commitXAResource(String xatx)
Returns:
Returns all XAResources that require administrator recovery action.

rollbackXAResource

public int rollbackXAResource(String xatx)
Returns:
Returns all XAResources that require administrator recovery action.

forgetXAResource

public int forgetXAResource(String xatx)
Returns:
Returns all XAResources that require administrator recovery action.

attachTransaction

public void attachTransaction(Xid xid,
                              long timeout)
                       throws NotSupportedException,
                              SystemException
Attach the current calling Thread to the given Xid.

Specified by:
attachTransaction in interface TransactionService
Parameters:
xid - Transaction id.
timeout - Transaction timeout.
Throws:
NotSupportedException - if the TM cannot attach the given Xid.
SystemException - if the TM cannot attach the given Xid.

detachTransaction

public void detachTransaction()
Detach the current Thread of the running Transaction.

Specified by:
detachTransaction in interface TransactionService


Copyright © 2007 OW2 Consortium. All Rights Reserved.