Package com.sun.jts.jta
Class UserTransactionImpl
- java.lang.Object
-
- com.sun.jts.jta.UserTransactionImpl
-
- All Implemented Interfaces:
jakarta.transaction.UserTransaction,Serializable,Referenceable
public class UserTransactionImpl extends Object implements jakarta.transaction.UserTransaction, Referenceable, Serializable
This class implements the jakarta.transaction.UserTransaction interface which defines methods that allow an application to explicitly manage transaction boundaries.- Version:
- 1.0 Feb 09, 1999
- Author:
- Ram Jeyaraman
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UserTransactionImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbegin()Create a new transaction and associate it with the current thread.voidcommit()Complete the transaction associated with the current thread.ReferencegetReference()This method is used by JNDI to store a referenceable object.intgetStatus()Obtain the status of the transaction associated with the current thread.voidrollback()Roll back the transaction associated with the current thread.voidsetRollbackOnly()Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.voidsetTransactionTimeout(int seconds)Modify the timeout value that is associated with transactions started by subsequent invocations of the begin method.
-
-
-
Method Detail
-
begin
public void begin() throws jakarta.transaction.NotSupportedException, jakarta.transaction.SystemExceptionCreate a new transaction and associate it with the current thread.- Specified by:
beginin interfacejakarta.transaction.UserTransaction- Throws:
IllegalStateException- Thrown if the thread is already associated with a transaction.jakarta.transaction.SystemException- Thrown if the transaction manager encounters an unexpected error conditionjakarta.transaction.NotSupportedException
-
commit
public void commit() throws jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, SecurityException, IllegalStateException, jakarta.transaction.SystemExceptionComplete the transaction associated with the current thread. When this method completes, the thread becomes associated with no transaction.- Specified by:
commitin interfacejakarta.transaction.UserTransaction- Throws:
jakarta.transaction.TransactionRolledbackException- Thrown to indicate that the transaction has been rolled back rather than committed.jakarta.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.jakarta.transaction.HeuristicRollbackException- Thrown to indicate that a heuristic decision was made and that all relevant updates have been rolled back.SecurityException- Thrown to indicate that the thread is not allowed to commit the transaction.IllegalStateException- Thrown if the current thread is not associated with a transaction.jakarta.transaction.SystemException- Thrown if the transaction manager encounters an unexpected error conditionjakarta.transaction.RollbackException
-
rollback
public void rollback() throws IllegalStateException, SecurityException, jakarta.transaction.SystemExceptionRoll back the transaction associated with the current thread. When this method completes, the thread becomes associated with no transaction.- Specified by:
rollbackin interfacejakarta.transaction.UserTransaction- Throws:
SecurityException- Thrown to indicate that the thread is not allowed to roll back the transaction.IllegalStateException- Thrown if the current thread is not associated with a transaction.jakarta.transaction.SystemException- Thrown if the transaction manager encounters an unexpected error condition
-
setRollbackOnly
public void setRollbackOnly() throws IllegalStateException, jakarta.transaction.SystemExceptionModify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.- Specified by:
setRollbackOnlyin interfacejakarta.transaction.UserTransaction- Throws:
IllegalStateException- Thrown if the current thread is not associated with a transaction.jakarta.transaction.SystemException- Thrown if the transaction manager encounters an unexpected error condition
-
getStatus
public int getStatus() throws jakarta.transaction.SystemExceptionObtain the status of the transaction associated with the current thread.- Specified by:
getStatusin interfacejakarta.transaction.UserTransaction- Returns:
- The transaction status. If no transaction is associated with the current thread, this method returns the Status.NoTransaction value.
- Throws:
jakarta.transaction.SystemException- Thrown if the transaction manager encounters an unexpected error condition
-
setTransactionTimeout
public void setTransactionTimeout(int seconds) throws jakarta.transaction.SystemExceptionModify the timeout value that is associated with transactions started by subsequent invocations of the begin method.If an application has not called this method, the transaction service uses some default value for the transaction timeout.
- Specified by:
setTransactionTimeoutin interfacejakarta.transaction.UserTransaction- Parameters:
seconds- 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.- Throws:
jakarta.transaction.SystemException- Thrown if the transaction manager encounters an unexpected error condition.
-
getReference
public Reference getReference() throws NamingException
This method is used by JNDI to store a referenceable object.- Specified by:
getReferencein interfaceReferenceable- Throws:
NamingException
-
-