use of org.quartz.Trigger in project cachecloud by sohutv.
the class MachineCenterImpl method unDeployMachineMonitor.
@Override
public boolean unDeployMachineMonitor(long hostId, String ip) {
Assert.isTrue(hostId > 0);
Assert.hasText(ip);
TriggerKey monitorTriggerKey = TriggerKey.triggerKey(ip, ConstUtils.MACHINE_MONITOR_TRIGGER_GROUP + hostId);
Trigger trigger = schedulerCenter.getTrigger(monitorTriggerKey);
if (trigger == null) {
return true;
}
return schedulerCenter.unscheduleJob(monitorTriggerKey);
}
use of org.quartz.Trigger in project cachecloud by sohutv.
the class RedisSlowLogJob method action.
@Override
public void action(JobExecutionContext context) {
try {
SchedulerContext schedulerContext = context.getScheduler().getContext();
ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY);
RedisCenter redisCenter = (RedisCenter) applicationContext.getBean("redisCenter");
JobDataMap dataMap = context.getMergedJobDataMap();
String host = dataMap.getString(ConstUtils.HOST_KEY);
int port = dataMap.getInt(ConstUtils.PORT_KEY);
long appId = dataMap.getLong(ConstUtils.APP_KEY);
Trigger trigger = context.getTrigger();
long collectTime = ScheduleUtil.getCollectTime(trigger.getPreviousFireTime());
redisCenter.collectRedisSlowLog(appId, collectTime, host, port);
} catch (SchedulerException e) {
logger.error(e.getMessage(), e);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
use of org.quartz.Trigger in project cachecloud by sohutv.
the class RedisCenterImpl method unDeployRedisSlowLogCollection.
@Override
public boolean unDeployRedisSlowLogCollection(long appId, String host, int port) {
Assert.isTrue(appId > 0);
Assert.hasText(host);
Assert.isTrue(port > 0);
TriggerKey triggerKey = TriggerKey.triggerKey(ObjectConvert.linkIpAndPort(host, port), ConstUtils.REDIS_SLOWLOG_TRIGGER_GROUP + appId);
Trigger trigger = schedulerCenter.getTrigger(triggerKey);
if (trigger == null) {
return true;
}
return schedulerCenter.unscheduleJob(triggerKey);
}
use of org.quartz.Trigger in project engine by craftercms.
the class SchedulingUtils method createJobContext.
public static JobContext createJobContext(SiteContext siteContext, String scriptUrl, String cronExpression, ServletContext servletContext) {
String jobName = siteContext.getSiteName() + ":" + scriptUrl;
JobDetail detail = SchedulingUtils.createScriptJob(siteContext, jobName, scriptUrl, servletContext);
Trigger trigger = SchedulingUtils.createCronTrigger("trigger for " + jobName, cronExpression);
String description = "Job{url='" + scriptUrl + "', cron='" + cronExpression + "'}";
return new JobContext(detail, trigger, description);
}
use of org.quartz.Trigger in project ddf by codice.
the class ScheduledCommandTask method newTask.
@Override
public void newTask() {
LOGGER.trace("Creating new Task.");
long identifier = System.currentTimeMillis();
this.jobKey = new JobKey("job" + identifier, jobClass.getSimpleName());
this.triggerKey = new TriggerKey("trigger" + identifier, jobClass.getSimpleName());
JobDetail jobDetail = createJob();
Trigger trigger = createTrigger();
if (trigger == null) {
return;
}
try {
scheduler.scheduleJob(jobDetail, trigger);
} catch (SchedulerException e) {
LOGGER.info("Error with scheduling of task.", e);
}
}
Aggregations