Package de.uplanet.server.transaction
Class TransactionManager
java.lang.Object
de.uplanet.server.transaction.TransactionManager
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidaddAfterCommitAction(IAfterCommitAction p_action) Add an action to the current transaction that will be performed after the transaction has been committed.static voidbegin()Starts the transaction associated to the current thread.static voidcommit()Commits the transaction associated with the current thread.static voidend()Complete the current transaction, i.e.static TransactionManagerDeprecated.Call the static methods directly.static ITransactionReturns the transaction for the current thread.static booleanCheck if the current thread has a transaction.static voidrollback()Rollbacks the transaction of the current thread.static voidPut the current transaction into the rollback mode, such that callingend()will rollback the transaction.
- 
Constructor Details- 
TransactionManagerpublic TransactionManager()
 
- 
- 
Method Details- 
getInstanceDeprecated.Call the static methods directly.- Returns:
- A new instance of TransactionManager.
 
- 
beginpublic static void begin()Starts the transaction associated to the current thread. Creates an transaction object, if none is created for the current thread right now. This method ignores a multiple begin calls, and writes a log entry in this case.
- 
commitpublic static void commit() throws de.uplanet.server.transaction.TransactionManagerExceptionCommits the transaction associated with the current thread. After this call no transaction object is associated with the thread anymore.- Throws:
- de.uplanet.server.transaction.TransactionManagerException
 
- 
rollbackpublic static void rollback() throws de.uplanet.server.transaction.TransactionManagerExceptionRollbacks the transaction of the current thread. After this call no transaction object is associated with the thread anymore.- Throws:
- de.uplanet.server.transaction.TransactionManagerException
 
- 
endpublic static void end() throws de.uplanet.server.transaction.TransactionManagerExceptionComplete the current transaction, i.e.- commit()if- setRollbackOnly()has not been called, or
- rollback()if- setRollbackOnly()has been called
 - Throws:
- de.uplanet.server.transaction.TransactionManagerException
 
- 
hasTransactionpublic static boolean hasTransaction()Check if the current thread has a transaction.- Returns:
- trueif the current threads has a transaction, or- falseotherwise.
 
- 
getTransactionReturns the transaction for the current thread.- Returns:
- The current transaction or nullif no transaction was set.
 
- 
setRollbackOnlypublic static void setRollbackOnly()Put the current transaction into the rollback mode, such that callingend()will rollback the transaction.
- 
addAfterCommitActionAdd an action to the current transaction that will be performed after the transaction has been committed.Note: This method must not be called if hasTransaction()isfalse.- Parameters:
- p_action- The action to be performed after commit.
- Throws:
- IllegalStateException- If the method is being called while- hasTransaction()is- false.
 
 
-