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 aroundHolder.This wrapper is created in
CMISTransactionAwareHolderInterceptor. It is designed to handle the state of theHolderin case of tx retries which are handled byRetryingTransactionInterceptor.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.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.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
-
The wrapper is created in
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TgetValue()voidsetValue(T value)java.lang.StringtoString()
-
-
-
Method Detail
-
getValue
public T getValue()
- Overrides:
getValuein classorg.apache.chemistry.opencmis.commons.spi.Holder<T>
-
setValue
public void setValue(T value)
- Overrides:
setValuein classorg.apache.chemistry.opencmis.commons.spi.Holder<T>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classorg.apache.chemistry.opencmis.commons.spi.Holder<T>
-
-