Class DelegatingTransactionSynchronizationRegistry
- All Implemented Interfaces:
TransactionSynchronizationRegistry
abstract TransactionSynchronizationRegistry
implementation that delegates all method invocations to another
TransactionSynchronizationRegistry.
Design Notes
This class is public for convenience. It is extended by
other non-public internal classes.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDeprecated, for removal: This API element is subject to removal in a future version.Creates a newDelegatingTransactionSynchronizationRegistry. -
Method Summary
Modifier and TypeMethodDescriptiongetResource(Object key) Deprecated, for removal: This API element is subject to removal in a future version.Gets an object from theMapof resources being managed for the transaction bound to the current thread at the time this method is called.booleanDeprecated, for removal: This API element is subject to removal in a future version.Get therollbackOnlystatus of the transaction bound to the current thread at the time this method is called.Deprecated, for removal: This API element is subject to removal in a future version.Return an opaque object to represent the transaction bound to the current thread at the time this method is called.intDeprecated, for removal: This API element is subject to removal in a future version.Return the status of the transaction bound to the current thread at the time this method is called.voidputResource(Object key, Object value) Deprecated, for removal: This API element is subject to removal in a future version.Adds or replaces an object in theMapof resources being managed for the transaction bound to the current thread at the time this method is called.voidregisterInterposedSynchronization(Synchronization synchronization) Deprecated, for removal: This API element is subject to removal in a future version.Registers aSynchronizationinstance with special ordering semantics.voidDeprecated, for removal: This API element is subject to removal in a future version.Sets therollbackOnlystatus of the transaction bound to the current thread at the time this method is called.
-
Constructor Details
-
DelegatingTransactionSynchronizationRegistry
Deprecated, for removal: This API element is subject to removal in a future version.Creates a newDelegatingTransactionSynchronizationRegistry.- Parameters:
delegate- theTransactionSynchronizationRegistryto which all method invocations will be delegated; may benullin which case every method in this class will throw anIllegalStateExceptionwhen invoked
-
-
Method Details
-
getTransactionKey
Deprecated, for removal: This API element is subject to removal in a future version.Return an opaque object to represent the transaction bound to the current thread at the time this method is called.This method may return
null.This object overrides
Object.hashCode()andObject.equals(Object)to allow its use as the key in aMapfor use by the caller. If there is no transaction currently active, this method will returnnull.The
Objectreturned will return the same hashCode and compare equal to all other objects returned by calling this method from any component executing in the same transaction context in the same application server.The
Object.toString()method returns aStringthat might be usable by a human reader to usefully understand the transaction context. TheObject.toString()result is otherwise not defined. Specifically, there is no forward or backward compatibility guarantee of the results of the returnedObject'sObject.toString()override.The object is not necessarily serializable, and has no defined behavior outside the virtual machine whence it was obtained.
- Specified by:
getTransactionKeyin interfaceTransactionSynchronizationRegistry- Returns:
- an opaque object representing the transaction bound to
the current thread at the time this method is called, or
null - Throws:
IllegalStateException- if anulldelegatewas supplied at construction time
-
putResource
Deprecated, for removal: This API element is subject to removal in a future version.Adds or replaces an object in theMapof resources being managed for the transaction bound to the current thread at the time this method is called.The supplied key should be of an caller-defined class so as not to conflict with other users. The class of the key must guarantee that the
hashCode()andequals(Object)methods are suitable for use as keys in aMap. The key and value are not examined or used by the implementation. The general contract of this method is that ofMap.put(Object, Object)for aMapthat supports non-nullkeys and null values. For example, if there is already an value associated with the key, it is replaced by thevalueparameter.- Specified by:
putResourcein interfaceTransactionSynchronizationRegistry- Parameters:
key- the key for theMapentry; must not benullvalue- the value for theMapentry- Throws:
IllegalStateException- if no transaction is active or if anulldelegatewas supplied at construction timeNullPointerException- if the parameterkeyisnull
-
getResource
Deprecated, for removal: This API element is subject to removal in a future version.Gets an object from theMapof resources being managed for the transaction bound to the current thread at the time this method is called.The key should have been supplied earlier by a call to
putResource(Object, Object)in the same transaction. If the key cannot be found in the current resourceMap,nullis returned. The general contract of this method is that ofMap.get(Object)for aMapthat supports non-nullkeys and null values. For example, the returned value is null if there is no entry for the parameterkeyor if the value associated with the key is actuallynull.- Specified by:
getResourcein interfaceTransactionSynchronizationRegistry- Parameters:
key- the key for theMapentry- Returns:
- the value associated with the supplied
key; may benull - Throws:
IllegalStateException- if no transaction is active or if anulldelegatewas supplied at construction timeNullPointerException- if the parameterkeyisnull
-
registerInterposedSynchronization
Deprecated, for removal: This API element is subject to removal in a future version.Registers aSynchronizationinstance with special ordering semantics.The supplied
Synchronization'sSynchronization.beforeCompletion()method will be called after allSessionSynchronization#beforeCompletion()callbacks and callbacks registered directly with theTransaction, but before the 2-phase commit process starts. Similarly, theSynchronization.afterCompletion(int)callback will be called after 2-phase commit completes but before anySessionSynchronizationandTransactionafterCompletion(int)callbacks.The
Synchronization.beforeCompletion()callback will be invoked in the transaction context of the transaction bound to the current thread at the time this method is called. Allowable methods include access to resources, e.g. connectors. No access is allowed to "user components" (e.g. timer services or bean methods), as these might change the state of data being managed by the caller, and might change the state of data that has already been flushed by another caller ofregisterInterposedSynchronization(Synchronization). The general context is the component context of the caller ofregisterInterposedSynchronization(Synchronization).The
Synchronization.afterCompletion(int)callback will be invoked in an undefined context. No access is permitted to "user components" as defined above. Resources can be closed but no transactional work can be performed with them.If this method is invoked without an active transaction context, an
IllegalStateExceptionis thrown.If this method is invoked after the two-phase commit processing has started, an
IllegalStateExceptionis thrown.- Specified by:
registerInterposedSynchronizationin interfaceTransactionSynchronizationRegistry- Parameters:
synchronization- theSynchronizationto register; must not benull- Throws:
IllegalStateException- if no transaction is active or two-phase commit processing has started or if anulldelegatewas supplied at construction time- See Also:
-
getTransactionStatus
public int getTransactionStatus()Deprecated, for removal: This API element is subject to removal in a future version.Return the status of the transaction bound to the current thread at the time this method is called.This is the result of executing
TransactionManager.getStatus()in the context of the transaction bound to the current thread at the time this method is called.- Specified by:
getTransactionStatusin interfaceTransactionSynchronizationRegistry- Returns:
- the status of the transaction bound to the current
thread at the time this method is called; will be equal the
value of one of the constants defined in the
Statusclass - Throws:
IllegalStateException- if anulldelegatewas supplied at construction time- See Also:
-
setRollbackOnly
public void setRollbackOnly()Deprecated, for removal: This API element is subject to removal in a future version.Sets therollbackOnlystatus of the transaction bound to the current thread at the time this method is called.- Specified by:
setRollbackOnlyin interfaceTransactionSynchronizationRegistry- Throws:
IllegalStateException- if no transaction is active or if anulldelegatewas supplied at construction time
-
getRollbackOnly
public boolean getRollbackOnly()Deprecated, for removal: This API element is subject to removal in a future version.Get therollbackOnlystatus of the transaction bound to the current thread at the time this method is called.- Specified by:
getRollbackOnlyin interfaceTransactionSynchronizationRegistry- Returns:
- the
rollbackOnlystatus - Throws:
IllegalStateException- if no transaction is active or if anulldelegatewas supplied at construction time
-