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 void
begin(int txTimeout)
Begin the transactionboolean
canBegin()
Can UserTransaction be started? Can start only if it doesn't already exist.void
commit()
Commit the transactionint
getStatus()
jakarta.transaction.Status of the UserTransactionString
getStatusAsString()
jakarta.transaction.Status as a String.boolean
isActive()
Is the UserTransaction active on this thread?boolean
isMarkedForRollback()
Is the UserTransaction marked for roll back?void
rollback()
Roll back the transactionvoid
setRollbackOnly()
Mark the transaction as roll back onlyboolean
transactionExists()
Is transaction associated with the current thread?boolean
userTransactionAvailable()
Is the UserTransaction available?
-
-
-
Method Detail
-
begin
void begin(int txTimeout) throws TransactionException
Begin the transaction- Parameters:
txTimeout
- Transaction timeout in seconds- Throws:
TransactionException
-
commit
void commit() throws TransactionException
Commit the transaction- Throws:
TransactionException
-
rollback
void rollback() throws TransactionException
Roll back the transaction- Throws:
TransactionException
-
setRollbackOnly
void setRollbackOnly() throws TransactionException
Mark the transaction as roll back only- Throws:
TransactionException
-
userTransactionAvailable
boolean userTransactionAvailable() throws TransactionException
Is the UserTransaction available?- Returns:
- true if UserTransaction can be looked up from JNDI, otherwise false
- Throws:
TransactionException
-
isActive
boolean isActive() throws TransactionException
Is the UserTransaction active on this thread?- Returns:
- true if UserTransaction status is active
- Throws:
TransactionException
-
isMarkedForRollback
boolean isMarkedForRollback() throws TransactionException
Is the UserTransaction marked for roll back?- Returns:
- true if UserTransaction is marked for roll back
- Throws:
TransactionException
-
canBegin
boolean canBegin() throws TransactionException
Can 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 TransactionException
Is transaction associated with the current thread?- Returns:
- true if transaction is flowing on the current thread
- Throws:
TransactionException
-
getStatus
int getStatus() throws TransactionException
jakarta.transaction.Status of the UserTransaction- Returns:
- status integer of the UserTransaction
- Throws:
TransactionException
-
getStatusAsString
String getStatusAsString() throws TransactionException
jakarta.transaction.Status as a String. Useful for logging.- Returns:
- status as a String
- Throws:
TransactionException
-
-