com.atomikos.icatch.jta
Class UserTransactionManager

java.lang.Object
  extended by com.atomikos.icatch.jta.UserTransactionManager
All Implemented Interfaces:
Serializable, Referenceable, TransactionManager, UserTransaction

public class UserTransactionManager
extends Object
implements TransactionManager, Serializable, Referenceable, UserTransaction

A straightforward, zero-setup implementation of a transaction manager. J2SE applications can use an instance of this class to get a handle to the transaction manager, and automatically startup or recover the transaction service on first use. J2EE applications should NOT use this class in order to avoid the concurrent use of different transaction services. For J2EE applications, we have the class J2eeTransactionManager instead.

See Also:
Serialized Form

Constructor Summary
UserTransactionManager()
           
 
Method Summary
 void begin()
           
 void close()
          Closes the transaction service, but only if it was implicitly started via this instance.
 void commit()
           
 boolean getForceShutdown()
           
 Reference getReference()
           
 boolean getStartupTransactionService()
          Returns true if the transaction service will be started if not already running.
 int getStatus()
           
 Transaction getTransaction()
           
 void init()
          Performs initialization if necessary.
 void resume(Transaction tx)
           
 void rollback()
           
 void setForceShutdown(boolean value)
          Sets the force shutdown mode to use during close.
 void setRollbackOnly()
           
 void setStartupTransactionService(boolean startup)
          Sets whether the transaction service should be started if not already running.
 void setTransactionTimeout(int secs)
           
 Transaction suspend()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserTransactionManager

public UserTransactionManager()
Method Detail

setStartupTransactionService

public void setStartupTransactionService(boolean startup)
Sets whether the transaction service should be started if not already running.

Parameters:
startup -

getStartupTransactionService

public boolean getStartupTransactionService()
Returns true if the transaction service will be started if not already running.

Returns:

init

public void init()
          throws SystemException
Performs initialization if necessary. This will startup the TM (if not running) and perform recovery, unless getStartupTransactionService returns false.

Throws:
SystemException

begin

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

getForceShutdown

public boolean getForceShutdown()

setForceShutdown

public void setForceShutdown(boolean value)
Sets the force shutdown mode to use during close.

Parameters:
value -

commit

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

getStatus

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

getTransaction

public Transaction getTransaction()
                           throws SystemException
Specified by:
getTransaction in interface TransactionManager
Throws:
SystemException
See Also:
TransactionManager.getTransaction()

resume

public void resume(Transaction tx)
            throws InvalidTransactionException,
                   IllegalStateException,
                   SystemException
Specified by:
resume in interface TransactionManager
Throws:
InvalidTransactionException
IllegalStateException
SystemException
See Also:
TransactionManager.resume(javax.transaction.Transaction)

rollback

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

setRollbackOnly

public void setRollbackOnly()
                     throws IllegalStateException,
                            SystemException
Specified by:
setRollbackOnly in interface TransactionManager
Specified by:
setRollbackOnly in interface UserTransaction
Throws:
IllegalStateException
SystemException
See Also:
TransactionManager.setRollbackOnly()

setTransactionTimeout

public void setTransactionTimeout(int secs)
                           throws SystemException
Specified by:
setTransactionTimeout in interface TransactionManager
Specified by:
setTransactionTimeout in interface UserTransaction
Throws:
SystemException
See Also:
TransactionManager.setTransactionTimeout(int)

suspend

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

getReference

public Reference getReference()
                       throws NamingException
Specified by:
getReference in interface Referenceable
Throws:
NamingException
See Also:
Referenceable.getReference()

close

public void close()
Closes the transaction service, but only if it was implicitly started via this instance. In other words, if the transaction service was started in another way then this method will not do anything.



Copyright © 2011. All Rights Reserved.