mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
59882: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3) 59607: Merged DEV to V4.2-BUG-FIX 58111: Ensure a transaction is present while initialising the DictionaryRepositoryBootstrap (Repo-based dictionary) (MNT-9806) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62198 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -36,6 +36,8 @@ import org.alfresco.repo.i18n.MessageService;
|
||||
import org.alfresco.repo.tenant.TenantAdminService;
|
||||
import org.alfresco.repo.tenant.TenantDeployer;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
@@ -207,12 +209,34 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
// NOOP - will be destroyed directly via DictionaryComponent
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.repo.dictionary.DictionaryListener#onInit()
|
||||
/**
|
||||
* Initialise the dictionary, ensuring that a transaction is available
|
||||
*/
|
||||
@Override
|
||||
public void onDictionaryInit()
|
||||
{
|
||||
RetryingTransactionCallback<Void> initCallback = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
onDictionaryInitInTxn();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(initCallback, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the actual repository access, checking for the existence of a valid transaction
|
||||
*/
|
||||
private void onDictionaryInitInTxn()
|
||||
{
|
||||
if (AlfrescoTransactionSupport.getTransactionReadState() == TxnReadState.TXN_NONE)
|
||||
{
|
||||
throw new IllegalStateException("The Repository-based dictionary initialization has to be done in the context of a transaction.");
|
||||
}
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
if (logger.isTraceEnabled())
|
||||
|
Reference in New Issue
Block a user