Package org.alfresco.opencmis
Class TransactionAwareHolder<T>
java.lang.Object
org.apache.chemistry.opencmis.commons.spi.Holder<T>
org.alfresco.opencmis.TransactionAwareHolder<T>
public class TransactionAwareHolder<T>
extends org.apache.chemistry.opencmis.commons.spi.Holder<T>
A Tx aware wrapper around
Holder.
This wrapper is created in CMISTransactionAwareHolderInterceptor.
It is designed to handle the state of the Holder in case of tx retries which are handled by
RetryingTransactionInterceptor.
There are a few things that influenced the implementation of this wrapper and need to be taken into account:
-
The wrapper is created in
CMISTransactionAwareHolderInterceptorand is replacing the incoming parameter (Holder) in the call toAlfrescoCmisServiceImpl. -
The calls to
AlfrescoCmisServiceImplgenerally return nothing, therefore the state ofHolderor it's wrapper (TransactionAwareHolder) is modified inside theAlfrescoCmisServiceImpland then read in CMIS layer. -
The
CMISTransactionAwareHolderInterceptoris called afterRetryingTransactionInterceptorbut due to internal counter in Spring AOP it is not called again if the tx is retried. The proxied service (AlfrescoCmisServiceImpl) is called straight away. Fortunately the parameter replacing is not required for the second time. The wrapper (TransactionAwareHolder) will still be used. -
The
TransactionAwareHolder<T>.org.alfresco.opencmis.TransactionAwareHolder.TxAwareHolderListeneris bound to the tx when the internal value is read. This is done this way because once the tx is rolled backed the listener list is cleared. TheTransactionAwareHolder<T>.org.alfresco.opencmis.TransactionAwareHolder.TxAwareHolderListeneris still required to be called once the retry succeeds with a commit. TheCMISTransactionAwareHolderInterceptorcannot recreate theTransactionAwareHolderas the interceptor is called only once. It is safe to bind the same listener many times as it is always the same object.
- Author:
- alex.mukha
-
Method Summary