public interface Transaction extends Transaction
Transaction Properties
Transaction properties are key/value pairs. Once set, they remain associated with a transaction during its entire lifetime. They are propagated between machines as the transaction travels through the system. They also are saved in the transaction log, and restored during crash recovery processing.
If a transaction property is set more than once the latest value is retained. However, in some threaded and/or multi-server situations, this behavior may not be predictable.
Key names prefixed with "weblogic.transaction" are reserved for use by Oracle.
Transaction Status
Recovery and audit-trail procedures require more information about a transaction than the JTA Transaction interface furnishes; information such as the transaction identifier, the specific reason for a rollback, and any heuristic error messages. In addition, the time taken by the transaction and the amount of time left can be used as limits on certain operations.
Transaction
Modifier and Type | Field and Description |
---|---|
static String |
ENLISTMENT_RESOURCE_TYPE
The transaction property key that is used internally as the
enlisted resource type (such as Weblogic JMS, see ENLISTMENT_RESOURCE_TYPE_WEBLOGIC_JMS)
for a transaction.
|
static String |
ENLISTMENT_RESOURCE_TYPE_WEBLOGIC_JMS
A transaction value to the ENLISTMENT_RESOURCE_TYPE key
indicating the enlisted resource is a WebLogic JMS resource
|
static String |
TRANSACTION_COMPLETION_TIMEOUT_SECONDS_PROPERTY_KEY
The transaction property key that is used internally as the
completion-timeout-seconds override for a transaction.
|
static String |
TRANSACTION_EAGER_END_ON_DELIST_PROPERTY_KEY
The transaction property key that is used internally to indicate, via boolean value,
whether XAResource.end must be called immediately rather than deferred.
|
static String |
TRANSACTION_NAME_PROPERTY_KEY
The transaction property key that is used internally to store the
name associated with a transaction.
|
Modifier and Type | Method and Description |
---|---|
void |
addProperties(Map props)
Adds a set of properties to a transaction by calling setProperty
for all elements of props.
|
boolean |
delistResourceWithProperties(XAResource xaRes,
int flags,
Map delistmentProperties)
Delist a Resource with specific properties in the transaction.
|
boolean |
enlistResource(NonXAResource nxar)
Enlist a Non-XA Resource in the transaction.
|
boolean |
enlistResourceWithProperties(XAResource xaRes,
Map enlistmentProperties)
Enlist a Resource with specific properties in the transaction.
|
String |
getHeuristicErrorMessage()
Returns the heuristic error message (if any) associated with the
transaction.
|
long |
getMillisSinceBegin()
Returns the amount of time, in milliseconds, that the transaction
has been in existence.
|
String |
getName()
Retrieves the name previously associated with a transaction.
|
Map |
getProperties()
Gets all properties currently associated with a transaction.
|
Serializable |
getProperty(String key)
Gets the value of a specific property.
|
Throwable |
getRollbackReason()
Retrieves the rollback reason (if any)
associated with the transaction.
|
String |
getStatusAsString()
Returns the status of the transaction as a string.
|
long |
getTimeToLiveMillis()
Returns the amount of time, in milliseconds, that the transaction
has left to go.
|
Xid |
getXid() |
Xid |
getXID()
Gets the transaction identifier.
|
boolean |
isTimedOut()
Returns true if the transaction has timed out, false otherwise.
|
boolean |
isTxAsyncTimeout() |
void |
setName(String n)
Associates a name with a transaction.
|
void |
setProperty(String key,
Serializable value)
Sets a property value to be associated with a transaction.
|
void |
setRollbackOnly(String msg)
Wraps the rollback string message and calls
setRollbackOnly with this new message.
|
void |
setRollbackOnly(String msg,
Throwable reason)
Wraps the rollback string message and the exception and calls
setRollbackOnly with this new exception.
|
void |
setRollbackOnly(Throwable reason)
Provides a reason for the rollback.
|
commit, delistResource, enlistResource, getStatus, registerSynchronization, rollback, setRollbackOnly
static final String TRANSACTION_NAME_PROPERTY_KEY
static final String TRANSACTION_COMPLETION_TIMEOUT_SECONDS_PROPERTY_KEY
static final String ENLISTMENT_RESOURCE_TYPE
static final String ENLISTMENT_RESOURCE_TYPE_WEBLOGIC_JMS
static final String TRANSACTION_EAGER_END_ON_DELIST_PROPERTY_KEY
void setName(String n)
String getName()
void setProperty(String key, Serializable value)
key
- A string keyvalue
- Property value, null means deletevoid addProperties(Map props)
props
- Set of key/value pairs to addSerializable getProperty(String key)
key
- Property nameMap getProperties()
void setRollbackOnly(Throwable reason)
reason
- the reason behind the rollback.void setRollbackOnly(String msg, Throwable reason)
reason
- the reason behind the rollback.Transaction.setRollbackOnly(Throwable)
void setRollbackOnly(String msg)
msg
- the message behind the rollback.Transaction.setRollbackOnly(Throwable)
Throwable getRollbackReason()
Transaction.setRollbackOnly(Throwable reason)
String getHeuristicErrorMessage()
Xid getXID()
Xid getXid()
Transaction.getXID()
String getStatusAsString()
long getMillisSinceBegin()
long getTimeToLiveMillis()
boolean isTimedOut()
boolean isTxAsyncTimeout()
boolean enlistResourceWithProperties(XAResource xaRes, Map enlistmentProperties) throws RollbackException, IllegalStateException, SystemException
boolean enlistResource(NonXAResource nxar) throws RollbackException, IllegalStateException, SystemException
boolean delistResourceWithProperties(XAResource xaRes, int flags, Map delistmentProperties) throws IllegalStateException, SystemException
IllegalStateException
SystemException