mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +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.TenantAdminService;
|
||||||
import org.alfresco.repo.tenant.TenantDeployer;
|
import org.alfresco.repo.tenant.TenantDeployer;
|
||||||
import org.alfresco.repo.tenant.TenantService;
|
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.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
@@ -207,12 +209,34 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
|||||||
// NOOP - will be destroyed directly via DictionaryComponent
|
// NOOP - will be destroyed directly via DictionaryComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* (non-Javadoc)
|
* Initialise the dictionary, ensuring that a transaction is available
|
||||||
* @see org.alfresco.repo.dictionary.DictionaryListener#onInit()
|
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onDictionaryInit()
|
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();
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
if (logger.isTraceEnabled())
|
if (logger.isTraceEnabled())
|
||||||
|
Reference in New Issue
Block a user