Interface TransactionHandler
-
- All Known Implementing Classes:
TransactionHandlerImpl
public interface TransactionHandler- Author:
- Uday Joshi
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbegin(int txTimeout)Begin the transactionbooleancanBegin()Can UserTransaction be started? Can start only if it doesn't already exist.voidcommit()Commit the transactionintgetStatus()javax.transaction.Status of the UserTransactionStringgetStatusAsString()javax.transaction.Status as a String.booleanisActive()Is the UserTransaction active on this thread?booleanisMarkedForRollback()Is the UserTransaction marked for roll back?voidrollback()Roll back the transactionvoidsetRollbackOnly()Mark the transaction as roll back onlybooleantransactionExists()Is transaction associated with the current thread?booleanuserTransactionAvailable()Is the UserTransaction available?
-
-
-
Method Detail
-
begin
void begin(int txTimeout) throws TransactionExceptionBegin the transaction- Parameters:
txTimeout- Transaction timeout in seconds- Throws:
TransactionException
-
commit
void commit() throws TransactionExceptionCommit the transaction- Throws:
TransactionException
-
rollback
void rollback() throws TransactionExceptionRoll back the transaction- Throws:
TransactionException
-
setRollbackOnly
void setRollbackOnly() throws TransactionExceptionMark the transaction as roll back only- Throws:
TransactionException
-
userTransactionAvailable
boolean userTransactionAvailable() throws TransactionExceptionIs the UserTransaction available?- Returns:
- true if UserTransaction can be looked up from JNDI, otherwise false
- Throws:
TransactionException
-
isActive
boolean isActive() throws TransactionExceptionIs the UserTransaction active on this thread?- Returns:
- true if UserTransaction status is active
- Throws:
TransactionException
-
isMarkedForRollback
boolean isMarkedForRollback() throws TransactionExceptionIs the UserTransaction marked for roll back?- Returns:
- true if UserTransaction is marked for roll back
- Throws:
TransactionException
-
canBegin
boolean canBegin() throws TransactionExceptionCan UserTransaction be started? Can start only if it doesn't already exist.- Returns:
- true if UserTransaction can be started
- Throws:
TransactionException
-
transactionExists
boolean transactionExists() throws TransactionExceptionIs transaction associated with the current thread?- Returns:
- true if transaction is flowing on the current thread
- Throws:
TransactionException
-
getStatus
int getStatus() throws TransactionExceptionjavax.transaction.Status of the UserTransaction- Returns:
- status integer of the UserTransaction
- Throws:
TransactionException
-
getStatusAsString
String getStatusAsString() throws TransactionException
javax.transaction.Status as a String. Useful for logging.- Returns:
- status as a String
- Throws:
TransactionException
-
-