mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Enhancements to FSR.
1) Performance imporvements (client and server are now multi-threaded + other performance work) 2) Pluggable transport protocols (ENH-145) 3) Changes to initialisation (ALFCOM-135) 4) Changes to the action service to enable multiple async event queues. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11022 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -112,11 +112,12 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
|
||||
|
||||
/** The authentication component */
|
||||
private AuthenticationComponent authenticationComponent;
|
||||
|
||||
|
||||
/**
|
||||
* The asynchronous action execution queue
|
||||
* The asynchronous action execution queues
|
||||
* map of name, queue
|
||||
*/
|
||||
private AsynchronousActionExecutionQueue asynchronousActionExecutionQueue;
|
||||
private Map<String, AsynchronousActionExecutionQueue> asynchronousActionExecutionQueues;
|
||||
|
||||
/**
|
||||
* Action transaction listener
|
||||
@@ -182,26 +183,16 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the asynchronous action execution queue
|
||||
* Set the asynchronous action execution queues
|
||||
*
|
||||
* @param asynchronousActionExecutionQueue the asynchronous action execution queue
|
||||
* @param asynchronousActionExecutionQueue the asynchronous action execution queues
|
||||
*/
|
||||
public void setAsynchronousActionExecutionQueue(
|
||||
AsynchronousActionExecutionQueue asynchronousActionExecutionQueue)
|
||||
public void setAsynchronousActionExecutionQueues(
|
||||
Map<String, AsynchronousActionExecutionQueue> asynchronousActionExecutionQueues)
|
||||
{
|
||||
this.asynchronousActionExecutionQueue = asynchronousActionExecutionQueue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the asychronous action execution queue
|
||||
*
|
||||
* @return the asynchronous action execution queue
|
||||
*/
|
||||
public AsynchronousActionExecutionQueue getAsynchronousActionExecutionQueue()
|
||||
{
|
||||
return asynchronousActionExecutionQueue;
|
||||
this.asynchronousActionExecutionQueues = asynchronousActionExecutionQueues;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -404,6 +395,71 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
|
||||
addPostTransactionPendingAction(action, actionedUponNodeRef, checkConditions, actionChain);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* called by transaction service.
|
||||
*/
|
||||
public void postCommit()
|
||||
{
|
||||
for (PendingAction pendingAction : getPostTransactionPendingActions())
|
||||
{
|
||||
queueAction(pendingAction);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void queueAction(PendingAction action)
|
||||
{
|
||||
// Get the right queue
|
||||
AsynchronousActionExecutionQueue queue = getQueue(action.action);
|
||||
|
||||
// Queue the action for execution
|
||||
queue.executeAction(
|
||||
this,
|
||||
action.getAction(),
|
||||
action.getActionedUponNodeRef(),
|
||||
action.getCheckConditions(),
|
||||
action.getActionChain());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param compensatingAction
|
||||
* @param actionedUponNodeRef
|
||||
*/
|
||||
private void queueAction(Action compensatingAction, NodeRef actionedUponNodeRef)
|
||||
{
|
||||
// Get the right queue
|
||||
AsynchronousActionExecutionQueue queue = getQueue(compensatingAction);
|
||||
|
||||
// Queue the action for execution
|
||||
queue.executeAction(this, compensatingAction, actionedUponNodeRef, false, null);
|
||||
}
|
||||
|
||||
private AsynchronousActionExecutionQueue getQueue(Action action)
|
||||
{
|
||||
ActionExecuter executer = (ActionExecuter)this.applicationContext.getBean(action.getActionDefinitionName());
|
||||
AsynchronousActionExecutionQueue queue = null;
|
||||
|
||||
String queueName = executer.getQueueName();
|
||||
if(queueName == null)
|
||||
{
|
||||
queue = asynchronousActionExecutionQueues.get("");
|
||||
}
|
||||
else
|
||||
{
|
||||
queue = asynchronousActionExecutionQueues.get(queueName);
|
||||
}
|
||||
if(queue == null)
|
||||
{
|
||||
// can't get queue
|
||||
throw new ActionServiceException("Unable to get AsynchronousActionExecutionQueue name: "+ queueName);
|
||||
}
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.RuntimeActionService#executeActionImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef, boolean, org.alfresco.service.cmr.repository.NodeRef)
|
||||
@@ -501,9 +557,7 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
|
||||
{
|
||||
// Set the current user
|
||||
((ActionImpl)compensatingAction).setRunAsUser(currentUserName);
|
||||
|
||||
// Queue the compensating action ready for execution
|
||||
this.asynchronousActionExecutionQueue.executeAction(this, compensatingAction, actionedUponNodeRef, false, null);
|
||||
queueAction(compensatingAction, actionedUponNodeRef);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1195,7 +1249,7 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
|
||||
* @see org.alfresco.repo.action.RuntimeActionService#getPostTransactionPendingActions()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<PendingAction> getPostTransactionPendingActions()
|
||||
private List<PendingAction> getPostTransactionPendingActions()
|
||||
{
|
||||
return (List<PendingAction>)AlfrescoTransactionSupport.getResource(POST_TRANSACTION_PENDING_ACTIONS);
|
||||
}
|
||||
@@ -1203,7 +1257,7 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
|
||||
/**
|
||||
* Pending action details class
|
||||
*/
|
||||
public class PendingAction
|
||||
private class PendingAction
|
||||
{
|
||||
/**
|
||||
* The action
|
||||
|
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
package org.alfresco.repo.action;
|
||||
|
||||
import org.alfresco.repo.action.ActionServiceImpl.PendingAction;
|
||||
import org.alfresco.repo.transaction.TransactionListener;
|
||||
import org.alfresco.util.GUID;
|
||||
|
||||
@@ -81,15 +80,7 @@ public class ActionTransactionListener implements TransactionListener
|
||||
*/
|
||||
public void afterCommit()
|
||||
{
|
||||
for (PendingAction pendingAction : this.actionService.getPostTransactionPendingActions())
|
||||
{
|
||||
this.actionService.getAsynchronousActionExecutionQueue().executeAction(
|
||||
actionService,
|
||||
pendingAction.getAction(),
|
||||
pendingAction.getActionedUponNodeRef(),
|
||||
pendingAction.getCheckConditions(),
|
||||
pendingAction.getActionChain());
|
||||
}
|
||||
this.actionService.postCommit();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -24,10 +24,8 @@
|
||||
*/
|
||||
package org.alfresco.repo.action;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.repo.action.ActionServiceImpl.PendingAction;
|
||||
import org.alfresco.repo.action.evaluator.ActionConditionEvaluator;
|
||||
import org.alfresco.repo.action.executer.ActionExecuter;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
@@ -39,12 +37,17 @@ import org.alfresco.service.namespace.QName;
|
||||
*/
|
||||
public interface RuntimeActionService
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void postCommit();
|
||||
|
||||
/**
|
||||
* Get the asynchronous action queue.
|
||||
*
|
||||
* @return the asynchronous action queue
|
||||
*/
|
||||
AsynchronousActionExecutionQueue getAsynchronousActionExecutionQueue();
|
||||
//AsynchronousActionExecutionQueue getAsynchronousActionExecutionQueue();
|
||||
|
||||
/**
|
||||
* Register an action condition evaluator
|
||||
@@ -93,10 +96,10 @@ public interface RuntimeActionService
|
||||
*/
|
||||
public void directActionExecution(Action action, NodeRef actionedUponNodeRef);
|
||||
|
||||
/**
|
||||
* Gets a list of the actions that are pending post transaction
|
||||
*
|
||||
* @return list of pending actions
|
||||
*/
|
||||
public List<PendingAction> getPostTransactionPendingActions();
|
||||
// /**
|
||||
// * Gets a list of the actions that are pending post transaction
|
||||
// *
|
||||
// * @return list of pending actions
|
||||
// */
|
||||
// public List<PendingAction> getPostTransactionPendingActions();
|
||||
}
|
||||
|
@@ -54,4 +54,10 @@ public interface ActionExecuter
|
||||
public void execute(
|
||||
Action action,
|
||||
NodeRef actionedUponNodeRef);
|
||||
|
||||
/**
|
||||
* Get the queueName that will execute this action
|
||||
*/
|
||||
String getQueueName();
|
||||
|
||||
}
|
||||
|
@@ -53,6 +53,13 @@ public abstract class ActionExecuterAbstractBase extends ParameterizedItemAbstra
|
||||
|
||||
/** List of types and aspects for which this action is applicable */
|
||||
protected List<QName> applicableTypes = new ArrayList<QName>();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String queueName = "";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Init method
|
||||
@@ -127,6 +134,18 @@ public abstract class ActionExecuterAbstractBase extends ParameterizedItemAbstra
|
||||
* @param actionedUponNodeRef the actioned upon node
|
||||
*/
|
||||
protected abstract void executeImpl(Action action, NodeRef actionedUponNodeRef);
|
||||
|
||||
/**
|
||||
* Set the queueName which will execute this action
|
||||
* if blank or null then the action will be executed on the "default" queue
|
||||
* @param the name of the execution queue which should execute this action.
|
||||
*/
|
||||
public void setQueueName(String queueName)
|
||||
{
|
||||
this.queueName = queueName;
|
||||
}
|
||||
|
||||
|
||||
public String getQueueName() {
|
||||
return queueName;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user