use of org.quartz.TriggerKey in project opennms by OpenNMS.
the class ImportScheduler method printCurrentSchedule.
private void printCurrentSchedule() {
try {
LOG.info("calendarNames: {}", String.join(", ", getScheduler().getCalendarNames().toArray(new String[0])));
LOG.info("current executing jobs: {}", StringUtils.arrayToCommaDelimitedString(getScheduler().getCurrentlyExecutingJobs().toArray()));
LOG.info("current job names: {}", getScheduler().getJobKeys(GroupMatcher.<JobKey>groupEquals(JOB_GROUP)).stream().map(JobKey::getName).collect(Collectors.joining(", ")));
LOG.info("scheduler metadata: {}", getScheduler().getMetaData());
LOG.info("trigger names: {}", getScheduler().getTriggerKeys(GroupMatcher.<TriggerKey>groupEquals(JOB_GROUP)).stream().map(TriggerKey::getName).collect(Collectors.joining(", ")));
for (TriggerKey key : getScheduler().getTriggerKeys(GroupMatcher.<TriggerKey>groupEquals(JOB_GROUP))) {
String triggerName = key.getName();
CronTrigger t = (CronTrigger) getScheduler().getTrigger(key);
LOG.info("trigger: {}, calendar name: {}, cron expression: {}, URL: {}, rescanExisting: {}, next fire time: {}, previous fire time: {}, time zone: {}, priority: {}", triggerName, t.getCalendarName(), t.getCronExpression(), t.getJobDataMap().get(ImportJob.URL), t.getJobDataMap().get(ImportJob.RESCAN_EXISTING), t.getNextFireTime(), t.getPreviousFireTime(), t.getTimeZone(), t.getPriority());
}
} catch (Throwable e) {
LOG.error("printCurrentSchedule: {}", e.getLocalizedMessage(), e);
}
}
use of org.quartz.TriggerKey in project camel by apache.
the class CronScheduledRoutePolicy method createTrigger.
@Override
protected Trigger createTrigger(Action action, Route route) throws Exception {
Trigger trigger = null;
CronScheduleBuilder scheduleBuilder = null;
String triggerPrefix = null;
if (action == Action.START) {
scheduleBuilder = CronScheduleBuilder.cronSchedule(getRouteStartTime());
triggerPrefix = TRIGGER_START;
} else if (action == Action.STOP) {
scheduleBuilder = CronScheduleBuilder.cronSchedule(getRouteStopTime());
triggerPrefix = TRIGGER_STOP;
} else if (action == Action.SUSPEND) {
scheduleBuilder = CronScheduleBuilder.cronSchedule(getRouteSuspendTime());
triggerPrefix = TRIGGER_SUSPEND;
} else if (action == Action.RESUME) {
scheduleBuilder = CronScheduleBuilder.cronSchedule(getRouteResumeTime());
triggerPrefix = TRIGGER_RESUME;
}
if (scheduleBuilder != null) {
if (timeZone != null) {
scheduleBuilder.inTimeZone(timeZone);
}
TriggerKey triggerKey = new TriggerKey(triggerPrefix + route.getId(), TRIGGER_GROUP + route.getId());
trigger = TriggerBuilder.newTrigger().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
}
return trigger;
}
use of org.quartz.TriggerKey in project camel by apache.
the class ScheduledRoutePolicy method retrieveTriggerKey.
public TriggerKey retrieveTriggerKey(Action action, String routeId) {
ScheduledRouteDetails scheduledRouteDetails = getScheduledRouteDetails(routeId);
TriggerKey result = null;
if (action == Action.START) {
result = scheduledRouteDetails.getStartTriggerKey();
} else if (action == Action.STOP) {
result = scheduledRouteDetails.getStopTriggerKey();
} else if (action == Action.SUSPEND) {
result = scheduledRouteDetails.getSuspendTriggerKey();
} else if (action == Action.RESUME) {
result = scheduledRouteDetails.getResumeTriggerKey();
}
return result;
}
use of org.quartz.TriggerKey in project camel by apache.
the class ScheduledRoutePolicy method pauseRouteTrigger.
public void pauseRouteTrigger(Action action, String routeId) throws SchedulerException {
TriggerKey triggerKey = retrieveTriggerKey(action, routeId);
getScheduler().pauseTrigger(triggerKey);
LOG.debug("Scheduled trigger: {} is paused", triggerKey);
}
use of org.quartz.TriggerKey in project camel by apache.
the class QuartzEndpointConfigureTest method testConfigureNoDoubleSlashNoCron.
@Test
public void testConfigureNoDoubleSlashNoCron() throws Exception {
QuartzEndpoint endpoint = resolveMandatoryEndpoint("quartz2:myGroup/myTimerName");
TriggerKey triggerKey = endpoint.getTriggerKey();
assertEquals("getName()", "myTimerName", triggerKey.getName());
assertEquals("getGroup()", "myGroup", triggerKey.getGroup());
}
Aggregations