diff --git a/source/java/org/alfresco/repo/action/ActionServiceImplTest.java b/source/java/org/alfresco/repo/action/ActionServiceImplTest.java index 742d8481ec..7d816b2e2b 100644 --- a/source/java/org/alfresco/repo/action/ActionServiceImplTest.java +++ b/source/java/org/alfresco/repo/action/ActionServiceImplTest.java @@ -673,18 +673,18 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest final NodeService finalNodeService = this.nodeService; final NodeRef finalNodeRef = this.nodeRef; -// postAsyncActionTest( -// this.transactionService, -// 100000000, -// 10, -// new AsyncTest() -// { -// public boolean executeTest() -// { -// return ( -// finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_VERSIONABLE)); -// }; -// }); + postAsyncActionTest( + this.transactionService, + 1000, + 10, + new AsyncTest() + { + public boolean executeTest() + { + return ( + finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_VERSIONABLE)); + }; + }); } @@ -715,19 +715,19 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest final NodeService finalNodeService = this.nodeService; final NodeRef finalNodeRef = this.nodeRef; -// postAsyncActionTest( -// this.transactionService, -// 1000, -// 10, -// new AsyncTest() -// { -// public boolean executeTest() -// { -// return ( -// finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_VERSIONABLE) && -// finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_LOCKABLE)); -// }; -// }); + postAsyncActionTest( + this.transactionService, + 1000, + 10, + new AsyncTest() + { + public boolean executeTest() + { + return ( + finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_VERSIONABLE) && + finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_LOCKABLE)); + }; + }); } public void xtestAsyncLoadTest() diff --git a/source/java/org/alfresco/repo/action/AsynchronousActionExecutionQueueImpl.java b/source/java/org/alfresco/repo/action/AsynchronousActionExecutionQueueImpl.java index ac5ffabdd9..3f056427b4 100644 --- a/source/java/org/alfresco/repo/action/AsynchronousActionExecutionQueueImpl.java +++ b/source/java/org/alfresco/repo/action/AsynchronousActionExecutionQueueImpl.java @@ -28,8 +28,6 @@ import org.alfresco.service.cmr.action.ActionServiceException; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.transaction.TransactionService; -import freemarker.log.Logger; - /** * The asynchronous action execution queue implementation * @@ -271,30 +269,29 @@ public class AsynchronousActionExecutionQueueImpl extends ThreadPoolExecutor imp throw new ActionServiceException("Cannot execute action asynchronously since run as user is 'null'"); } - TransactionUtil.executeInNonPropagatingUserTransaction(this.transactionService, - new TransactionUtil.TransactionWork() - { - public Object doWork() - { - ActionExecutionWrapper.this.authenticationComponent - .setCurrentUser(userName); - - try - { + ActionExecutionWrapper.this.authenticationComponent.setCurrentUser(userName); + + try + { + TransactionUtil.executeInNonPropagatingUserTransaction(this.transactionService, + new TransactionUtil.TransactionWork() + { + public Object doWork() + { ActionExecutionWrapper.this.actionService.executeActionImpl( ActionExecutionWrapper.this.action, ActionExecutionWrapper.this.actionedUponNodeRef, ActionExecutionWrapper.this.checkConditions, true, ActionExecutionWrapper.this.actionChain); + + return null; } - finally - { - ActionExecutionWrapper.this.authenticationComponent.clearCurrentSecurityContext(); - } - - return null; - } - }); + }); + } + finally + { + ActionExecutionWrapper.this.authenticationComponent.clearCurrentSecurityContext(); + } } catch (Throwable exception) {