javax.transaction
Interface TransactionSynchronizationRegistry


public interface TransactionSynchronizationRegistry

TransactionSynchronizationRegistry.

Version:
$Revision: 61190 $
Author:
Adrian Brock

Method Summary
 Object getResource(Object key)
          Get a transaction local for the current transaction
 boolean getRollbackOnly()
          Get the rollback status of the transaction associated with the current thread.
 Object getTransactionKey()
          An object that has the same equals/hashCode behaviour as the transaction currently associated with the thread
 int getTransactionStatus()
          Get the transaction status of the current thread
 void putResource(Object key, Object value)
          Set a transaction local for the current transaction
 void registerInterposedSynchronization(Synchronization sync)
          Add a transaction synchronization that is invoked "last", i.e.
 void setRollbackOnly()
          Set the transaction associated with the current thread to force a rollback
 

Method Detail

getTransactionKey

Object getTransactionKey()
An object that has the same equals/hashCode behaviour as the transaction currently associated with the thread

Returns:
the key or null if there is no current transaction

getTransactionStatus

int getTransactionStatus()
Get the transaction status of the current thread

Returns:
the status

getRollbackOnly

boolean getRollbackOnly()
                        throws IllegalStateException
Get the rollback status of the transaction associated with the current thread.

Returns:
true when the transaction is rollback only
Throws:
IllegalStateException - if there is no current transaction

setRollbackOnly

void setRollbackOnly()
                     throws IllegalStateException
Set the transaction associated with the current thread to force a rollback

Throws:
IllegalStateException - if there is no current transaction

registerInterposedSynchronization

void registerInterposedSynchronization(Synchronization sync)
                                       throws IllegalStateException
Add a transaction synchronization that is invoked "last", i.e. after SessionSynchronizations and directly registered transaction synchronizations.

The beforeCompletion is invoked in the context of the transaction, the afterCompletion in an undefined transaction context. Other context is the same as when the one used to register the synchronization.

Access to "user components" is not allowed, e.g. ejb bean methods.

Access to other resources, e.g. jca, is allowed in the beforeCompletion, but not transactional work is allowed in the afterCompletion. e.g. typically only "close()" is allowed.

Parameters:
sync - the synchronization
Throws:
IllegalStateException - if there is no current transaction

getResource

Object getResource(Object key)
                   throws IllegalStateException
Get a transaction local for the current transaction

Parameters:
key - the key to the value
Returns:
the value
Throws:
IllegalStateException - if there is no current transaction
NullPointerException - if the key is null

putResource

void putResource(Object key,
                 Object value)
                 throws IllegalStateException
Set a transaction local for the current transaction

Parameters:
key - the key to the value
value - the value
Throws:
IllegalStateException - if there is no current transaction
NullPointerException - if the key is null


Copyright © 2008 JBoss Inc.. All Rights Reserved.