mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Make the cache objects used by the Action Tracking Service immutable
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22382 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -388,8 +388,12 @@ public class ActionTrackingServiceImpl implements ActionTrackingService
|
||||
return;
|
||||
}
|
||||
|
||||
// Since it is, update the cancelled flag on it
|
||||
details.requestCancel();
|
||||
// Create a new copy of the details, this time with
|
||||
// the cancel flag set
|
||||
details = new ExecutionDetails(
|
||||
details.getExecutionSummary(), details.getPersistedActionRef(),
|
||||
details.getRunningOn(), details.getStartedAt(), true
|
||||
);
|
||||
|
||||
// Save the flag to the cache
|
||||
executingActionsCache.put(actionKey, details);
|
||||
|
@@ -752,13 +752,16 @@ public class ActionTrackingServiceImplTest extends TestCase
|
||||
|
||||
// Get the updated key, and check
|
||||
key3 = ActionTrackingServiceImpl.generateCacheKey(sleepAction3);
|
||||
ExecutionSummary s3 = ActionTrackingServiceImpl.buildExecutionSummary(key3);
|
||||
|
||||
assertEquals(false, actionTrackingService.isCancellationRequested(sleepAction3));
|
||||
assertEquals(false, actionTrackingService.getExecutionDetails(s3).isCancelRequested());
|
||||
assertNotNull(executingActionsCache.get(key3));
|
||||
|
||||
actionTrackingService.requestActionCancellation(sleepAction3);
|
||||
|
||||
assertEquals(true, actionTrackingService.isCancellationRequested(sleepAction3));
|
||||
assertEquals(true, actionTrackingService.getExecutionDetails(s3).isCancelRequested());
|
||||
assertNotNull(executingActionsCache.get(key3));
|
||||
|
||||
// Have it finish sleeping, will have been cancelled
|
||||
|
Reference in New Issue
Block a user