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 void
begin()
Create a new transaction and associate it with the current thread.void
commit()
Complete the transaction associated with the current thread.Reference
getReference()
This method is used by JNDI to store a referenceable object.int
getStatus()
Obtain the status of the transaction associated with the current thread.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 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.SystemException
Create a new transaction and associate it with the current thread.- Specified by:
begin
in 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.SystemException
Complete the transaction associated with the current thread. When this method completes, the thread becomes associated with no transaction.- Specified by:
commit
in 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.SystemException
Roll back the transaction associated with the current thread. When this method completes, the thread becomes associated with no transaction.- Specified by:
rollback
in 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.SystemException
Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.- Specified by:
setRollbackOnly
in 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.SystemException
Obtain the status of the transaction associated with the current thread.- Specified by:
getStatus
in 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.SystemException
Modify 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:
setTransactionTimeout
in 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:
getReference
in interfaceReferenceable
- Throws:
NamingException
-
-