|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.portal.common.transaction.Transactions
Utility class for managing transactions.
Nested Class Summary | |
static interface |
Transactions.Runnable
|
static class |
Transactions.Type
|
Field Summary | |
private static org.apache.log4j.Logger |
log
. |
private static java.lang.String[] |
STATUS_NAMES
. |
static Transactions.Type |
TYPE_MANDATORY
|
static Transactions.Type |
TYPE_NEVER
|
static Transactions.Type |
TYPE_NOT_SUPPORTED
|
static Transactions.Type |
TYPE_REQUIRED
|
static Transactions.Type |
TYPE_REQUIRES_NEW
|
static Transactions.Type |
TYPE_SUPPORTS
|
Constructor Summary | |
Transactions()
|
Method Summary | |
static java.lang.Object |
apply(Transactions.Type type,
javax.transaction.TransactionManager tm,
Transactions.Runnable runnable)
Apply the transaction type around the unit of work. |
static void |
applyAfter(Transactions.Type type,
javax.transaction.TransactionManager tm,
javax.transaction.Transaction oldTx)
Apply the transaction type after the unit of work has been done. |
static javax.transaction.Transaction |
applyBefore(Transactions.Type type,
javax.transaction.TransactionManager tm)
Apply the transaction type before the unit of work. |
static void |
begin(javax.transaction.TransactionManager tm)
Begin a new transaction. |
static java.lang.String |
decodeStatus(int status)
Decode the status name. |
static boolean |
end(javax.transaction.TransactionManager tm)
Terminate the active transaction for this thread. |
static java.lang.Object |
mandatory(javax.transaction.TransactionManager tm,
Transactions.Runnable runnable)
|
static java.lang.Object |
never(javax.transaction.TransactionManager tm,
Transactions.Runnable runnable)
|
static java.lang.Object |
notSupported(javax.transaction.TransactionManager tm,
Transactions.Runnable runnable)
|
static java.lang.Object |
required(javax.transaction.TransactionManager tm,
Transactions.Runnable runnable)
|
static java.lang.Object |
requiresNew(javax.transaction.TransactionManager tm,
Transactions.Runnable runnable)
|
static void |
resume(javax.transaction.TransactionManager tm,
javax.transaction.Transaction tx)
Associate the thread with a transaction |
static void |
safeEnd(javax.transaction.TransactionManager tm)
|
void |
safeSetRollbackOnly(javax.transaction.TransactionManager tm)
|
private static void |
setRollbackOnly(javax.transaction.Transaction tx)
Mark the transaction as rollback only. |
static void |
setRollbackOnly(javax.transaction.TransactionManager tm)
Mark the active transaction for this thread as rollback only |
static java.lang.Object |
supports(javax.transaction.TransactionManager tm,
Transactions.Runnable runnable)
|
static javax.transaction.Transaction |
suspend(javax.transaction.TransactionManager tm)
Disassociate the current thread with the active transaction. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static org.apache.log4j.Logger log
private static final java.lang.String[] STATUS_NAMES
public static final Transactions.Type TYPE_NOT_SUPPORTED
public static final Transactions.Type TYPE_SUPPORTS
public static final Transactions.Type TYPE_REQUIRED
public static final Transactions.Type TYPE_REQUIRES_NEW
public static final Transactions.Type TYPE_MANDATORY
public static final Transactions.Type TYPE_NEVER
Constructor Detail |
public Transactions()
Method Detail |
public static java.lang.String decodeStatus(int status)
status
- the status value
public static javax.transaction.Transaction applyBefore(Transactions.Type type, javax.transaction.TransactionManager tm) throws TransactionException, java.lang.IllegalArgumentException
type
- the transaction typetm
- the transaction manager
TransactionException
IllegalArgumentException
- if the type or the transaction manager is nullpublic static void applyAfter(Transactions.Type type, javax.transaction.TransactionManager tm, javax.transaction.Transaction oldTx) throws TransactionException, java.lang.IllegalArgumentException
type
- the transaction typetm
- the transaction manageroldTx
- the old transaction if it is not null
TransactionException
IllegalArgumentException
- if the type of the transaction manager is nullpublic static java.lang.Object apply(Transactions.Type type, javax.transaction.TransactionManager tm, Transactions.Runnable runnable) throws NestedException, TransactionException, java.lang.IllegalArgumentException
type
- the transaction typetm
- the transaction managerrunnable
- the unit of work
NestedException
- wraps any exception throws by the runnable object
TransactionException
IllegalArgumentException
- if any method argument is nullpublic static java.lang.Object notSupported(javax.transaction.TransactionManager tm, Transactions.Runnable runnable) throws NestedException, TransactionException
NestedException
TransactionException
public static java.lang.Object never(javax.transaction.TransactionManager tm, Transactions.Runnable runnable) throws NestedException, TransactionException
NestedException
TransactionException
public static java.lang.Object mandatory(javax.transaction.TransactionManager tm, Transactions.Runnable runnable) throws NestedException, TransactionException
NestedException
TransactionException
public static java.lang.Object supports(javax.transaction.TransactionManager tm, Transactions.Runnable runnable) throws NestedException, TransactionException
NestedException
TransactionException
public static java.lang.Object required(javax.transaction.TransactionManager tm, Transactions.Runnable runnable) throws NestedException, TransactionException
NestedException
TransactionException
public static java.lang.Object requiresNew(javax.transaction.TransactionManager tm, Transactions.Runnable runnable) throws NestedException, TransactionException
NestedException
TransactionException
public static void begin(javax.transaction.TransactionManager tm) throws java.lang.IllegalArgumentException, TransactionException
tm
- the transaction manager
IllegalArgumentException
- if the tm is null
TransactionException
private static void setRollbackOnly(javax.transaction.Transaction tx) throws java.lang.IllegalArgumentException, TransactionException
tx
- the transaction to mark as rollback only
IllegalArgumentException
- if the transaction is null
TransactionException
public static void setRollbackOnly(javax.transaction.TransactionManager tm) throws java.lang.IllegalArgumentException, TransactionException
tm
- the transaction manager
IllegalArgumentException
- if the tm is null
TransactionException
setRollbackOnly(javax.transaction.Transaction)
public void safeSetRollbackOnly(javax.transaction.TransactionManager tm)
public static void safeEnd(javax.transaction.TransactionManager tm)
public static boolean end(javax.transaction.TransactionManager tm) throws java.lang.IllegalArgumentException, TransactionException
tm
- the transaction manager
IllegalArgumentException
- if the tm is null
TransactionException
public static void resume(javax.transaction.TransactionManager tm, javax.transaction.Transaction tx) throws java.lang.IllegalArgumentException, TransactionException
tm
- the transaction managertx
- the transaction to associate with the this thread
IllegalArgumentException
- if any argument is null
TransactionException
public static javax.transaction.Transaction suspend(javax.transaction.TransactionManager tm) throws java.lang.IllegalArgumentException, TransactionException
tm
- the transaction manager
IllegalArgumentException
- if the transaction manager is null
TransactionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |