* @return the updated ProcessInstance
*/
public Object advanceProcess(Object executionId, Object signalName, Map variables) throws Exception
{
int waitTime = 0;
Execution execution = processEngine.getExecutionService().findExecutionById((String) executionId);
while (execution == null && waitTime < PROCESS_CREATION_WAIT)
{
// Given the multi-threaded nature of Mule, sometimes a response message will arrive to advance the
// process before the creation of the process has fully terminated (e.g., during in-memory unit tests).
// We delay for awhile to make sure this is not the case before giving up and throwing an exception.
Thread.sleep(PROCESS_CREATION_WAIT / 10);
waitTime += (PROCESS_CREATION_WAIT / 10);
execution = processEngine.getExecutionService().findExecutionById((String) executionId);
}
if (execution == null)
{
throw new IllegalArgumentException("No process execution found with id = " + executionId + " (it may have already terminated)");
}
String processId;
if (execution.getProcessInstance() != null)
{
processId = execution.getProcessInstance().getId();
}
else
{
processId = execution.getId();
}
// Set any process variables.
if (variables != null && !variables.isEmpty())
{