public class TrmUserTransaction
extends java.lang.Object
implements javax.transaction.UserTransaction
Modifier and Type | Class and Description |
---|---|
static class |
TrmUserTransaction.TrmUserTransactionBuilder |
Constructor and Description |
---|
TrmUserTransaction()
Initialize a new OTMM user transaction
|
TrmUserTransaction(TrmUserTransaction.TrmUserTransactionBuilder builder) |
Modifier and Type | Method and Description |
---|---|
void |
begin()
Creates a new transaction and associates it with the current thread.
|
void |
begin(java.lang.Boolean enlist) |
void |
commit()
Commit the transaction associated with the current thread.
|
protected void |
finalize()
finalize make sure relevant ThreadLocal objects are removed in case of bug in application code where commit/rollback has not been called.
|
int |
getStatus()
Obtain the status of the transaction associated with the current thread.
|
java.lang.String |
getTransactionID()
Get OTMM user transaction ID associated with the current thread
|
java.lang.String |
getTxnExternalUrl()
Get OTMM user transaction external URL
|
java.lang.String |
getTxnInternalUrl()
Get OTMM user transaction internal URL
|
java.lang.String |
getTxnUrl() |
void |
resume()
Resume the transaction.
|
void |
rollback()
Roll back the transaction associated with the current thread.
|
void |
setRollbackOnly()
Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.
|
void |
setTransactionTimeout(int timeout)
Modify the timeout value that is associated with transactions started by the current thread with the begin method.
|
void |
suspend()
Suspend the transaction.
|
public TrmUserTransaction()
TrmUserTransaction(TrmUserTransaction.TrmUserTransactionBuilder builder)
public void begin() throws java.lang.IllegalStateException, javax.transaction.SystemException
begin
in interface javax.transaction.UserTransaction
java.lang.IllegalStateException
- The IllegalStateException is thrown to indicate the method is invoked at a wrong timejavax.transaction.SystemException
- The SystemException is thrown to indicate the OTMM has encountered an unexpected error conditionpublic void begin(java.lang.Boolean enlist) throws java.lang.IllegalStateException, javax.transaction.SystemException
java.lang.IllegalStateException
javax.transaction.SystemException
public void commit() throws javax.transaction.RollbackException, javax.transaction.HeuristicMixedException, javax.transaction.HeuristicRollbackException, java.lang.SecurityException, java.lang.IllegalStateException, javax.transaction.SystemException
commit
in interface javax.transaction.UserTransaction
javax.transaction.RollbackException
- - Thrown to indicate that the transaction has been rolled back rather than committed based on status/exception returned by transaction coordinator.javax.transaction.HeuristicMixedException
- - Thrown to indicate that a heuristic decision was made and that some relevant updates have been committed while others have been rolled back based on status/exception returned by transaction coordinator.javax.transaction.HeuristicRollbackException
- - Thrown to indicate that a heuristic decision was made and that all relevant updates have been rolled back based on status/exception returned by transaction coordinator.java.lang.SecurityException
- - Thrown to indicate that the thread is not allowed to commit the transaction.java.lang.IllegalStateException
- - Thrown if the current thread is not associated with a transaction.javax.transaction.SystemException
- - Thrown if an unexpected error condition is encountered.public void rollback() throws java.lang.IllegalStateException, java.lang.SecurityException, javax.transaction.SystemException
rollback
in interface javax.transaction.UserTransaction
java.lang.SecurityException
- - Thrown to indicate that the thread is not allowed to commit the transaction.java.lang.IllegalStateException
- - Thrown if the current thread is not associated with a transaction.javax.transaction.SystemException
- - Thrown if an unexpected error condition is encountered.public void suspend() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- Thrown if the current thread is not associated with a transaction.public void resume() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- Thrown if the current thread is not associated with a transaction.public java.lang.String getTransactionID() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- Thrown if the current UserTransaction instance/object has not been used to begin a transactionpublic void setRollbackOnly() throws java.lang.IllegalStateException
setRollbackOnly
in interface javax.transaction.UserTransaction
java.lang.IllegalStateException
- - Thrown if the current thread is not associated with a transaction.public int getStatus() throws javax.transaction.SystemException
getStatus
in interface javax.transaction.UserTransaction
javax.transaction.SystemException
- - Thrown if an unexpected error condition is encountered.public void setTransactionTimeout(int timeout)
setTransactionTimeout
in interface javax.transaction.UserTransaction
timeout
- The value of the timeout in seconds. If the value is zero, the transaction service restores the default value. If the value is negative a SystemException is thrown.protected void finalize()
finalize
in class java.lang.Object
public java.lang.String getTxnInternalUrl() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- The IllegalStateException is thrown to indicate the method is invoked at a wrong timepublic java.lang.String getTxnExternalUrl() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- The IllegalStateException is thrown to indicate the method is invoked at a wrong timepublic java.lang.String getTxnUrl() throws java.lang.IllegalStateException
java.lang.IllegalStateException
Copyright © 2022, Oracle and/or its affiliates.