|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ofbiz.entity.transaction.TransactionUtil
public class TransactionUtil
Transaction Utility to help with some common transaction tasks
Provides a wrapper around the transaction objects to allow for changes in underlying implementations in the future.
Nested Class Summary | |
---|---|
static class |
TransactionUtil.StampClearSync
|
Field Summary | |
---|---|
static java.util.Map<javax.transaction.xa.Xid,DebugXaResource> |
debugResMap
|
static boolean |
debugResources
|
static java.lang.String |
module
|
Constructor Summary | |
---|---|
TransactionUtil()
|
Method Summary | |
---|---|
static boolean |
begin()
Begins a transaction in the current thread IF transactions are available; only tries if the current transaction status is ACTIVE, if not active it returns false. |
static boolean |
begin(int timeout)
Begins a transaction in the current thread IF transactions are available; only tries if the current transaction status is ACTIVE, if not active it returns false. |
static int |
cleanSuspendedTransactions()
BE VERY CARFUL WHERE YOU CALL THIS!! |
protected static void |
clearTransactionStamps()
|
static void |
commit()
Commits the transaction in the current thread IF transactions are available |
static void |
commit(boolean beganTransaction)
Commits the transaction in the current thread IF transactions are available AND if beganTransaction is true |
static java.sql.Connection |
enlistConnection(javax.sql.XAConnection xacon)
Enlists the given XAConnection and if a transaction is active in the current thread, returns a plain JDBC Connection |
static void |
enlistResource(javax.transaction.xa.XAResource resource)
|
static java.util.Map<java.lang.Long,java.util.List<java.lang.Exception>> |
getAllThreadsTransactionBeginStackSave()
|
static org.ofbiz.entity.transaction.TransactionUtil.RollbackOnlyCause |
getSetRollbackOnlyCause()
|
static int |
getStatus()
Gets the status of the transaction in the current thread IF transactions are available, otherwise returns STATUS_NO_TRANSACTION |
static java.lang.String |
getStatusString()
|
static java.lang.Exception |
getTransactionBeginStack()
|
static java.util.List<java.lang.Exception> |
getTransactionBeginStackSave()
|
static int |
getTransactionBeginStackSaveSize()
|
static java.sql.Timestamp |
getTransactionStartStamp()
|
static java.lang.String |
getTransactionStateString(int state)
|
static java.sql.Timestamp |
getTransactionUniqueNowStamp()
|
static boolean |
isTransactionInPlace()
|
static void |
logRunningTx()
|
protected static Transaction |
popSuspendedTransaction()
|
static void |
printAllThreadsTransactionBeginStacks()
|
protected static void |
pushSuspendedTransaction(Transaction t)
|
static void |
registerSynchronization(Synchronization sync)
|
protected static void |
removeSuspendedTransaction(Transaction t)
|
static void |
resume(Transaction parentTx)
|
static void |
rollback()
Rolls back transaction in the current thread IF transactions are available |
static void |
rollback(boolean beganTransaction)
Deprecated. |
static void |
rollback(boolean beganTransaction,
java.lang.String causeMessage,
java.lang.Throwable causeThrowable)
Rolls back transaction in the current thread IF transactions are available AND if beganTransaction is true; if beganTransaction is not true, setRollbackOnly is called to insure that the transaction will be rolled back |
static void |
setRollbackOnly(java.lang.String causeMessage,
java.lang.Throwable causeThrowable)
Makes a rollback the only possible outcome of the transaction in the current thread IF transactions are available |
static void |
setTransactionTimeout(int seconds)
Sets the timeout of the transaction in the current thread IF transactions are available |
static Transaction |
suspend()
|
static boolean |
suspendedTransactionsHeld()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String module
public static java.util.Map<javax.transaction.xa.Xid,DebugXaResource> debugResMap
public static boolean debugResources
Constructor Detail |
---|
public TransactionUtil()
Method Detail |
---|
public static boolean begin() throws GenericTransactionException
GenericTransactionException
public static boolean begin(int timeout) throws GenericTransactionException
GenericTransactionException
public static int getStatus() throws GenericTransactionException
GenericTransactionException
public static java.lang.String getStatusString() throws GenericTransactionException
GenericTransactionException
public static boolean isTransactionInPlace() throws GenericTransactionException
GenericTransactionException
public static void commit(boolean beganTransaction) throws GenericTransactionException
GenericTransactionException
public static void commit() throws GenericTransactionException
GenericTransactionException
public static void rollback(boolean beganTransaction) throws GenericTransactionException
GenericTransactionException
public static void rollback(boolean beganTransaction, java.lang.String causeMessage, java.lang.Throwable causeThrowable) throws GenericTransactionException
GenericTransactionException
public static void rollback() throws GenericTransactionException
GenericTransactionException
public static void setRollbackOnly(java.lang.String causeMessage, java.lang.Throwable causeThrowable) throws GenericTransactionException
GenericTransactionException
public static Transaction suspend() throws GenericTransactionException
GenericTransactionException
public static void resume(Transaction parentTx) throws GenericTransactionException
GenericTransactionException
public static void setTransactionTimeout(int seconds) throws GenericTransactionException
GenericTransactionException
public static java.sql.Connection enlistConnection(javax.sql.XAConnection xacon) throws GenericTransactionException
GenericTransactionException
public static void enlistResource(javax.transaction.xa.XAResource resource) throws GenericTransactionException
GenericTransactionException
public static java.lang.String getTransactionStateString(int state)
public static void logRunningTx()
public static void registerSynchronization(Synchronization sync) throws GenericTransactionException
GenericTransactionException
public static int cleanSuspendedTransactions() throws GenericTransactionException
GenericTransactionException
public static boolean suspendedTransactionsHeld()
protected static void pushSuspendedTransaction(Transaction t)
protected static Transaction popSuspendedTransaction()
protected static void removeSuspendedTransaction(Transaction t)
public static int getTransactionBeginStackSaveSize()
public static java.util.List<java.lang.Exception> getTransactionBeginStackSave()
public static java.util.Map<java.lang.Long,java.util.List<java.lang.Exception>> getAllThreadsTransactionBeginStackSave()
public static void printAllThreadsTransactionBeginStacks()
public static java.lang.Exception getTransactionBeginStack()
public static org.ofbiz.entity.transaction.TransactionUtil.RollbackOnlyCause getSetRollbackOnlyCause()
public static java.sql.Timestamp getTransactionStartStamp()
public static java.sql.Timestamp getTransactionUniqueNowStamp()
protected static void clearTransactionStamps()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |