key = key.substring(KEY_RUNTIME_ATRIBUTE_PREFIX.length());
tc.setRuntimeAttribute(key, entry.getValue());
}
}
Engine engine = processServer.getEngine();
if (ProcessJobDescriptor.START_MODE_RESUME.equals(startMode))
{
// Resume an existing token
if (engine.hasActiveObservers(SchedulerEngineEvent.RESUME_JOB, tc))
{
ProcessJobDescriptor desc = ((QuartzProcessScheduler) processServer.getProcessScheduler()).createJobDescriptor(context.getJobDetail());
engine.fireEngineEvent(new SchedulerEngineEvent(SchedulerEngineEvent.RESUME_JOB, tc, desc, engine));
}
processFacade.resumeToken(tc, positionRef, inputParamValues);
}
else
{
// Start a new token
if (engine.hasActiveObservers(SchedulerEngineEvent.START_JOB, tc))
{
ProcessJobDescriptor desc = ((QuartzProcessScheduler) processServer.getProcessScheduler()).createJobDescriptor(context.getJobDetail());
engine.fireEngineEvent(new SchedulerEngineEvent(SchedulerEngineEvent.START_JOB, tc, desc, engine));
}
processFacade.startToken(tc, positionRef, inputParamValues);
}
// Process the token immediately if desired, otherwise let the execution thread pool do this.
if (ProcessJobDescriptor.EXECUTION_MODE_SYNCHRONOUS.equals(executionMode))
{
// We do not need to set the lifecycle to LifecycleState.SELECTED, it will be set to LifecycleState.RUNNING by the executeContext method
tc = processFacade.getTokenById(tokenId);
if (tc == null)
{
String msg = LogUtil.error(getClass(), "Cannot find the scheduled token context (id $0) for job $1.", tokenId, context
.getJobDetail().getGroup()
+ context.getJobDetail().getName());
JobExecutionException ex = new JobExecutionException(msg);
ex.setUnscheduleAllTriggers(true);
throw ex;
}
engine.executeContext(tc);
}
processFacade.commit();
}
catch (Exception e)