synchronized(currentWorkflows)
{
if(!isActive())
{
if(getEntryState() == WorkflowEntry.UNKNOWN)
throw new WorkflowException("The workflow with id " + workflowId + " is in an unknown state - the database could be down or the workflow corrupt");
else
throw new InvalidActionException("Workflow " + workflowId + " is no longer active");
}
if(currentWorkflows.contains(id))
{
throw new WorkflowException("The selected workflow is executing...");
}
currentWorkflows.add(id);
}
try
{
if(useDatabaseExtension(workflowDescriptor))
{
doExtendedAction(actionId, inputs);
}
else
{
workflow.doAction(workflowId, actionId, inputs);
}
}
finally
{
synchronized(currentWorkflows)
{
currentWorkflows.remove(id);
}
}
}
catch(Exception we)
{
logger.error("An error occurred when we tried to invoke an workflow action:" + we.getMessage());
//restoreSessionFactory(workflow, we);
throw new WorkflowException("An error occurred when we tried to invoke an workflow action:" + we.getMessage());
}
}