Show TOC

Background documentationTransaction Synchronization Registry Locate this document in the navigation structure

 

The Transaction Synchronization Registry is an interface that is part of the Java Transaction API (JTA) implementation. It is designed to provide Enterprise Java Beans (EJBs), Web application components, persistence managers, and resource adapters with the abilities to associate resources with ongoing transactions, to register synchronization objects according to specific ordering semantics, to obtain the transaction context and status of ongoing transactions, and to mark these transactions for rollback.

The TransactionSynchronizationRegistry object can be used by any number of thread-safe application server components.

An instance of the Transaction Synchronization Registry interface can be looked up via JNDI by the standard name java:comp/TransactionSynchronizationRegistry or via a dependency injection @Resource of the type TransactionSynchronizationRegistry.

Interface Methods

Type

Method and operation

Object

getResource(java.lang.Object key)

Gets a resource object for the transaction from the resource map.

boolean

getRollbackOnly()

Gets the rollbackOnly status of the transaction.

Object

getTransactionKey()

Returns an object to represent the transaction.

int

getTransactionStatus()

Returns the status of the transaction.

void

putResource(java.lang.Object key, java.lang.Object value)

Adds/replaces an object for the transaction in the resource map.

void

registerInterposedSynchronization(Synchronization sync)

Registers a synchronization object with special ordering semantics.

void

setRollbackOnly()

Sets the rollbackOnly status of the transaction.

Set the rollbackOnly status of the transaction bound to the current thread at the time this method is called.

For more information about the Transaction Synchronization Registry methods, refer to the Java Transaction API specification at http://java.sun.com.