use of org.quartz.Scheduler in project head by mifos.
the class BatchjobsServiceFacadeWebTier method suspend.
@Override
public void suspend(ServletContext context, String doSuspend) throws SchedulerException {
MifosScheduler mifosScheduler = (MifosScheduler) context.getAttribute(MifosScheduler.class.getName());
Scheduler scheduler = mifosScheduler.getScheduler();
if (doSuspend.equals(ApplicationContextProvider.getBean(MessageLookup.class).lookup("systemAdministration.batchjobs.suspend")) && !scheduler.isInStandbyMode()) {
scheduler.standby();
}
if (doSuspend.equals(ApplicationContextProvider.getBean(MessageLookup.class).lookup("systemAdministration.batchjobs.activate")) && scheduler.isInStandbyMode()) {
scheduler.start();
}
}
use of org.quartz.Scheduler in project elastic-job by dangdangdotcom.
the class JobScheduler method createScheduler.
private Scheduler createScheduler(final boolean isMisfire) {
Scheduler result;
try {
StdSchedulerFactory factory = new StdSchedulerFactory();
factory.initialize(getBaseQuartzProperties(isMisfire));
result = factory.getScheduler();
result.getListenerManager().addTriggerListener(jobExecutor.getSchedulerFacade().newJobTriggerListener());
} catch (final SchedulerException ex) {
throw new JobSystemException(ex);
}
return result;
}
use of org.quartz.Scheduler in project elastic-job by dangdangdotcom.
the class JobSchedulerTest method assertInit.
private void assertInit() throws NoSuchFieldException, SchedulerException {
verify(jobExecutor).init();
Scheduler scheduler = ReflectionUtils.getFieldValue(JobRegistry.getInstance().getJobScheduleController("test_job"), JobScheduleController.class.getDeclaredField("scheduler"));
assertThat(scheduler.getListenerManager().getTriggerListeners().size(), is(1));
assertThat(scheduler.getListenerManager().getTriggerListeners().get(0), instanceOf(JobTriggerListener.class));
assertTrue(scheduler.isStarted());
verify(schedulerFacade).newJobTriggerListener();
}
use of org.quartz.Scheduler in project spring-framework by spring-projects.
the class SchedulerAccessorBean method findScheduler.
protected Scheduler findScheduler(String schedulerName) throws SchedulerException {
if (this.beanFactory instanceof ListableBeanFactory) {
ListableBeanFactory lbf = (ListableBeanFactory) this.beanFactory;
String[] beanNames = lbf.getBeanNamesForType(Scheduler.class);
for (String beanName : beanNames) {
Scheduler schedulerBean = (Scheduler) lbf.getBean(beanName);
if (schedulerName.equals(schedulerBean.getSchedulerName())) {
return schedulerBean;
}
}
}
Scheduler schedulerInRepo = SchedulerRepository.getInstance().lookup(schedulerName);
if (schedulerInRepo == null) {
throw new IllegalStateException("No Scheduler named '" + schedulerName + "' found");
}
return schedulerInRepo;
}
use of org.quartz.Scheduler in project openhab1-addons by openhab.
the class MpdBinding method scheduleReconnect.
private void scheduleReconnect() {
Scheduler sched;
try {
sched = StdSchedulerFactory.getDefaultScheduler();
JobDetail job = newJob(ReconnectJob.class).withIdentity("Reconnect", MPD_SCHEDULER_GROUP).build();
CronTrigger trigger = newTrigger().withIdentity("Reconnect", MPD_SCHEDULER_GROUP).withSchedule(CronScheduleBuilder.cronSchedule("0 0 0 * * ?")).build();
sched.scheduleJob(job, trigger);
logger.debug("Scheduled a daily reconnect of all MPDs");
} catch (SchedulerException se) {
logger.warn("Scheduling MPD reconnect failed", se);
}
}
Aggregations