mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ACE-2780: Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
85506: Merged DEV to HEAD-BUG-FIX (5.0/Cloud) 85436 : ACE-2780 : TestActivities test never ends - Change transaction handling for multi-threaded feed generation. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@85532 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
*
|
||||||
@@ -65,6 +65,8 @@ import org.alfresco.repo.tenant.TenantAdminService;
|
|||||||
import org.alfresco.repo.tenant.TenantService;
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
import org.alfresco.repo.tenant.TenantUtil;
|
import org.alfresco.repo.tenant.TenantUtil;
|
||||||
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.repo.version.VersionModel;
|
import org.alfresco.repo.version.VersionModel;
|
||||||
import org.alfresco.rest.api.Activities;
|
import org.alfresco.rest.api.Activities;
|
||||||
import org.alfresco.rest.api.impl.node.ratings.RatingScheme;
|
import org.alfresco.rest.api.impl.node.ratings.RatingScheme;
|
||||||
@@ -195,6 +197,7 @@ public class RepoService
|
|||||||
protected HiddenAspect hiddenAspect;
|
protected HiddenAspect hiddenAspect;
|
||||||
protected NetworksService networksService;
|
protected NetworksService networksService;
|
||||||
protected NamespaceService namespaceService;
|
protected NamespaceService namespaceService;
|
||||||
|
protected RetryingTransactionHelper transactionHelper;
|
||||||
|
|
||||||
protected Activities activities;
|
protected Activities activities;
|
||||||
|
|
||||||
@@ -252,6 +255,7 @@ public class RepoService
|
|||||||
this.hiddenAspect = (HiddenAspect)applicationContext.getBean("hiddenAspect");
|
this.hiddenAspect = (HiddenAspect)applicationContext.getBean("hiddenAspect");
|
||||||
this.networksService = (NetworksService)applicationContext.getBean("networksService");
|
this.networksService = (NetworksService)applicationContext.getBean("networksService");
|
||||||
this.namespaceService = (NamespaceService)applicationContext.getBean("namespaceService");
|
this.namespaceService = (NamespaceService)applicationContext.getBean("namespaceService");
|
||||||
|
this.transactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper");
|
||||||
|
|
||||||
Scheduler scheduler = (Scheduler)applicationContext.getBean("schedulerFactory");
|
Scheduler scheduler = (Scheduler)applicationContext.getBean("schedulerFactory");
|
||||||
|
|
||||||
@@ -784,17 +788,39 @@ public class RepoService
|
|||||||
public void generateFeed() throws JobExecutionException, SQLException
|
public void generateFeed() throws JobExecutionException, SQLException
|
||||||
{
|
{
|
||||||
// process all outstanding activity posts
|
// process all outstanding activity posts
|
||||||
postLookup.execute();
|
transactionHelper.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void execute() throws Throwable
|
||||||
|
{
|
||||||
|
postLookup.execute();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, false, true);
|
||||||
|
|
||||||
Long maxSequence = postDAO.getMaxActivitySeq();
|
Long maxSequence = getMaxActivitySeq();
|
||||||
while(maxSequence != null)
|
while(maxSequence != null)
|
||||||
{
|
{
|
||||||
feedGenerator.execute();
|
feedGenerator.execute();
|
||||||
|
|
||||||
maxSequence = postDAO.getMaxActivitySeq();
|
maxSequence = getMaxActivitySeq();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Long getMaxActivitySeq() throws SQLException
|
||||||
|
{
|
||||||
|
Long maxSequence = transactionHelper.doInTransaction(new RetryingTransactionCallback<Long>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Long execute() throws Throwable
|
||||||
|
{
|
||||||
|
return postDAO.getMaxActivitySeq();
|
||||||
|
}
|
||||||
|
}, true, true);
|
||||||
|
|
||||||
|
return maxSequence;
|
||||||
|
}
|
||||||
|
|
||||||
public Tag addTag(NodeRef nodeRef, String tag)
|
public Tag addTag(NodeRef nodeRef, String tag)
|
||||||
{
|
{
|
||||||
NodeRef tagNodeRef = taggingService.addTag(nodeRef, tag);
|
NodeRef tagNodeRef = taggingService.addTag(nodeRef, tag);
|
||||||
|
Reference in New Issue
Block a user