mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ActionTrackingService work
Initial cancel support, and some duplicate instance work (mostly updating tests to handle it coming along). Duplicate id assignment work still remains git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21340 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -96,7 +96,12 @@ public class ActionTrackingServiceImpl implements ActionTrackingService
|
||||
{
|
||||
this.executingActionsCache = executingActionsCache;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Used by unit tests only */
|
||||
protected void resetNextExecutionId() {
|
||||
this.nextExecutionId = 1;
|
||||
}
|
||||
|
||||
|
||||
public void recordActionPending(Action action)
|
||||
@@ -139,6 +144,7 @@ public class ActionTrackingServiceImpl implements ActionTrackingService
|
||||
// TODO assign it a (unique) execution ID
|
||||
// (Keep checking to see if the key is used as we
|
||||
// increase nextExecutionId until it isn't)
|
||||
((ActionImpl)action).setExecutionInstance(nextExecutionId++); // TODO
|
||||
String key = generateCacheKey(action);
|
||||
|
||||
// Put it into the cache
|
||||
@@ -154,12 +160,30 @@ public class ActionTrackingServiceImpl implements ActionTrackingService
|
||||
{
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
logger.debug("Will shortly record failure of action " + action + " due to " + exception.getMessage());
|
||||
if(exception instanceof ActionCancelledException)
|
||||
{
|
||||
logger.debug("Will shortly record completed cancellation of action " + action);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.debug("Will shortly record failure of action " + action + " due to " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Record when it finished
|
||||
((ActionImpl)action).setExecutionEndDate(new Date());
|
||||
((ActionImpl)action).setExecutionStatus(ActionStatus.Failed);
|
||||
((ActionImpl)action).setExecutionFailureMessage(exception.getMessage());
|
||||
|
||||
// Record it as Failed or Cancelled, depending on the exception
|
||||
if(exception instanceof ActionCancelledException)
|
||||
{
|
||||
((ActionImpl)action).setExecutionStatus(ActionStatus.Cancelled);
|
||||
((ActionImpl)action).setExecutionFailureMessage(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
((ActionImpl)action).setExecutionStatus(ActionStatus.Failed);
|
||||
((ActionImpl)action).setExecutionFailureMessage(exception.getMessage());
|
||||
}
|
||||
|
||||
// Remove it from the cache, as it's no longer running
|
||||
String key = generateCacheKey(action);
|
||||
@@ -334,7 +358,7 @@ public class ActionTrackingServiceImpl implements ActionTrackingService
|
||||
return
|
||||
action.getActionDefinitionName() + cacheKeyPartSeparator +
|
||||
action.getId() + cacheKeyPartSeparator +
|
||||
"1"//action.getExecutionInstance // TODO
|
||||
((ActionImpl)action).getExecutionInstance()
|
||||
;
|
||||
}
|
||||
protected static String generateCacheKey(ExecutionSummary summary)
|
||||
@@ -381,7 +405,7 @@ public class ActionTrackingServiceImpl implements ActionTrackingService
|
||||
return new ExecutionSummary(
|
||||
action.getActionDefinitionName(),
|
||||
action.getId(),
|
||||
1 // TODO
|
||||
((ActionImpl)action).getExecutionInstance()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user