mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged BRANCHES/V3.4 to HEAD:
24356: It's possible for a persisted action to be removed during the transaction, so have the ActionTrackingService ensure the node still exists before doing the async update of the details (ALF-5745) 24374: ALF-5744 - Retry the add aspect to avoid failures due to concurrent node updates git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@24931 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -39,6 +39,7 @@ import org.alfresco.service.cmr.action.CancellableAction;
|
||||
import org.alfresco.service.cmr.action.ExecutionDetails;
|
||||
import org.alfresco.service.cmr.action.ExecutionSummary;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -56,6 +57,7 @@ public class ActionTrackingServiceImpl implements ActionTrackingService
|
||||
private static Log logger = LogFactory.getLog(ActionTrackingServiceImpl.class);
|
||||
|
||||
private SimpleCache<String, ExecutionDetails> executingActionsCache;
|
||||
private NodeService nodeService;
|
||||
private TransactionService transactionService;
|
||||
private RuntimeActionService runtimeActionService;
|
||||
|
||||
@@ -78,6 +80,16 @@ public class ActionTrackingServiceImpl implements ActionTrackingService
|
||||
this.transactionService = transactionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the node service
|
||||
*
|
||||
* @param nodeService the node service
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the runtime action service
|
||||
*
|
||||
@@ -139,7 +151,7 @@ public class ActionTrackingServiceImpl implements ActionTrackingService
|
||||
action.setExecutionFailureMessage(null);
|
||||
|
||||
// Do we need to update the persisted details?
|
||||
if (action.getNodeRef() != null)
|
||||
if (action.getNodeRef() != null && nodeService.exists(action.getNodeRef()))
|
||||
{
|
||||
// Make sure we re-fetch the latest action details and save
|
||||
// this version back into the repository
|
||||
@@ -164,8 +176,15 @@ public class ActionTrackingServiceImpl implements ActionTrackingService
|
||||
{
|
||||
public Action doWork() throws Exception
|
||||
{
|
||||
// Grab the latest version of the
|
||||
// action
|
||||
// Ensure the action persisted node still exists, and wasn't deleted
|
||||
// between when it loaded running and now
|
||||
if( !nodeService.exists(actionNode) )
|
||||
{
|
||||
// Persisted node has gone, nothing to update
|
||||
return null;
|
||||
}
|
||||
|
||||
// Grab the latest version of the action
|
||||
ActionImpl action = (ActionImpl) runtimeActionService
|
||||
.createAction(actionNode);
|
||||
|
||||
|
Reference in New Issue
Block a user