final String jobName = DEFAULT_AGENT_JOB + " - " + randomSuffix;
JobDetail jobDetail = new JobDetail(jobName, DEFAULT_AGENT_GROUP, NotifyAgentsOfScheduleUpdatesJob.class);
final String triggerName = DEFAULT_AGENT_TRIGGER + " - " + randomSuffix;
SimpleTrigger simpleTrigger = new SimpleTrigger(triggerName, DEFAULT_AGENT_GROUP, new Date());
JobDataMap jobDataMap = simpleTrigger.getJobDataMap();
jobDataMap.put(TRIGGER_NAME, triggerName);
jobDataMap.put(TRIGGER_GROUP_NAME, DEFAULT_AGENT_GROUP);
jobDataMap.put(SCHEDULE_SUBQUERY, scheduleSubQuery);
jobDataMap.put(ENTITYCONTEXT_RESOURCEID, Integer.toString(entityContext.getResourceId()));
jobDataMap.put(ENTITYCONTEXT_GROUPID, Integer.toString(entityContext.getGroupId()));
jobDataMap.put(ENTITYCONTEXT_PARENT_RESOURCEID, Integer.toString(entityContext.getParentResourceId()));
jobDataMap.put(ENTITYCONTEXT_RESOURCETYPEID, Integer.toString(entityContext.getResourceTypeId()));
if (isJobScheduled(scheduler, DEFAULT_AGENT_JOB, DEFAULT_AGENT_GROUP)) {
simpleTrigger.setJobName(DEFAULT_AGENT_JOB);
simpleTrigger.setJobGroup(DEFAULT_AGENT_GROUP);
scheduler.scheduleJob(simpleTrigger);
} else {
scheduler.scheduleJob(jobDetail, simpleTrigger);
}
} catch (RuntimeException e) {