develog

Quartz job fire manually 본문

Dev/Java

Quartz job fire manually

냐옴 2012. 12. 18. 11:54

private void test() {

try {

ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring-config.xml");

Service service = (Service) context.getBean("service");

JobDataMap jobDataMap = new JobDataMap();

jobDataMap.put("service", service);

JobDetail jobDetail = new JobDetail("job1", "group1", JobB.class);

jobDetail.setJobDataMap(jobDataMap);

CronTrigger cronTrigger = new CronTrigger("cronTrigger1", "group1", "0/5 * * * * ?");

StdSchedulerFactory sf = new StdSchedulerFactory();

Scheduler scheduler = sf.getScheduler();

scheduler.scheduleJob(jobDetail, cronTrigger);

scheduler.start();

} catch (ParseException e) {

e.printStackTrace();

} catch (SchedulerException e) {

e.printStackTrace();

}

}

'Dev > Java' 카테고리의 다른 글

AES  (0) 2013.01.27
poi 대용량 엑셀 write  (0) 2013.01.08
Quartz - Defining a Job  (0) 2012.12.14
java get ip  (0) 2012.12.14
Apache Derby Eclipse plug-in  (0) 2012.12.08
Comments