public final class ContextTransactionSynchronizationRegistry extends Object implements TransactionSynchronizationRegistry
TransactionSynchronizationRegistry
which operates against the current local provider.Modifier and Type | Method and Description |
---|---|
static ContextTransactionSynchronizationRegistry |
getInstance() |
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
|
public static ContextTransactionSynchronizationRegistry getInstance()
public Object getTransactionKey()
TransactionSynchronizationRegistry
getTransactionKey
in interface TransactionSynchronizationRegistry
public int getTransactionStatus()
TransactionSynchronizationRegistry
getTransactionStatus
in interface TransactionSynchronizationRegistry
public boolean getRollbackOnly() throws IllegalStateException
TransactionSynchronizationRegistry
getRollbackOnly
in interface TransactionSynchronizationRegistry
IllegalStateException
- if there is no current transactionpublic void setRollbackOnly() throws IllegalStateException
TransactionSynchronizationRegistry
setRollbackOnly
in interface TransactionSynchronizationRegistry
IllegalStateException
- if there is no current transactionpublic void registerInterposedSynchronization(Synchronization sync) throws IllegalStateException
TransactionSynchronizationRegistry
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.
registerInterposedSynchronization
in interface TransactionSynchronizationRegistry
sync
- the synchronizationIllegalStateException
- if there is no current transactionpublic Object getResource(Object key) throws IllegalStateException
TransactionSynchronizationRegistry
getResource
in interface TransactionSynchronizationRegistry
key
- the key to the valueIllegalStateException
- if there is no current transactionpublic void putResource(Object key, Object value) throws IllegalStateException
TransactionSynchronizationRegistry
putResource
in interface TransactionSynchronizationRegistry
key
- the key to the valuevalue
- the valueIllegalStateException
- if there is no current transactionCopyright © 2017 JBoss by Red Hat. All rights reserved.