org.jboss.portal.common.transaction
Class Transactions

java.lang.Object
  extended by org.jboss.portal.common.transaction.Transactions

public class Transactions
extends java.lang.Object

Helper for managing transactions around a runnable.


Nested Class Summary
static interface Transactions.Runnable
           
 
Constructor Summary
Transactions()
           
 
Method Summary
static void begin(javax.transaction.TransactionManager tm)
          Begin a new transaction.
static void end(javax.transaction.TransactionManager tm)
          Terminate the transaction.
static java.lang.Object required(javax.transaction.TransactionManager tm, Transactions.Runnable runnable)
           
static java.lang.Object requiresNew(javax.transaction.UserTransaction tx, Transactions.Runnable runnable)
           
static void resume(javax.transaction.TransactionManager tm, javax.transaction.Transaction tx)
           
static javax.transaction.Transaction suspend(javax.transaction.TransactionManager tm)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transactions

public Transactions()
Method Detail

required

public static java.lang.Object required(javax.transaction.TransactionManager tm,
                                        Transactions.Runnable runnable)
                                 throws NestedException
Throws:
NestedException

requiresNew

public static java.lang.Object requiresNew(javax.transaction.UserTransaction tx,
                                           Transactions.Runnable runnable)
                                    throws NestedException,
                                           TransactionException
Throws:
NestedException
TransactionException

begin

public static void begin(javax.transaction.TransactionManager tm)
                  throws java.lang.IllegalStateException
Begin a new transaction.

Parameters:
tm - the transaction manager
Throws:
java.lang.IllegalStateException - if the transaction cannot be started

end

public static void end(javax.transaction.TransactionManager tm)
Terminate the transaction. If the transaction is marked for rollback then it is rollbacked otherwise it is commited.

Parameters:
tm - the transaction manager

resume

public static void resume(javax.transaction.TransactionManager tm,
                          javax.transaction.Transaction tx)

suspend

public static javax.transaction.Transaction suspend(javax.transaction.TransactionManager tm)