public class TransactionAwareHolder<T>
extends org.apache.chemistry.opencmis.commons.spi.Holder<T>
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:
CMISTransactionAwareHolderInterceptor and is replacing the incoming
parameter (Holder) in the call to AlfrescoCmisServiceImpl.
AlfrescoCmisServiceImpl generally return nothing, therefore the state
of Holder or it's wrapper (TransactionAwareHolder) is modified inside
the AlfrescoCmisServiceImpl and then read in CMIS layer.
CMISTransactionAwareHolderInterceptor is called after RetryingTransactionInterceptor
but 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.
TxAwareHolderListener is 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.
The TxAwareHolderListener is still required to be called once the retry succeeds with a commit.
The CMISTransactionAwareHolderInterceptor cannot recreate the TransactionAwareHolder
as the interceptor is called only once.
It is safe to bind the same listener many times as it is always the same object.
Copyright © 2005–2018 Alfresco Software. All rights reserved.