Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- Windows
- Quartz
- 단축키
- import
- port
- resource
- JavaScript
- grep
- profile
- web.xml
- 줄바꿈 문자
- maVen
- tomcat
- lsof
- ssh
- Windows 10
- context
- Source
- find
- 네트워크
- plugin
- Mac
- IntelliJ
- bash
- vscode
- netsh
- VirtualBox
- xargs
- Eclipse
- GIT
Archives
- Today
- Total
develog
Quartz test 본문
package test;
import java.util.Date;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SimpleTrigger;
import org.quartz.impl.StdSchedulerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import test.util.JndiUtil;
public class TestQuartz {
private static ApplicationContext context;
public static void main(String[] args) throws Exception {
System.out.println("START");
System.out.println("-------------------------------------------");
JndiUtil.init();
context = new ClassPathXmlApplicationContext("test/config/beans.xml");
testTestJob();
System.out.println("-------------------------------------------");
System.out.println("END");
}
public static void testTestJob() throws Exception {
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.put("testService", context.getBean("testService"));
testScheduler("test.util.TestJob", jobDataMap);
}
public static void testScheduler(String className, JobDataMap jobDataMap) throws SchedulerException, ClassNotFoundException {
JobDetail job = new JobDetail();
job.setName("testJob");
job.setJobClass(Class.forName(className));
job.setJobDataMap(jobDataMap);
SimpleTrigger trigger = new SimpleTrigger();
trigger.setName("testTrigger");
trigger.setStartTime(new Date());
trigger.setRepeatCount(0);
trigger.setRepeatInterval(1000);
Scheduler scheduler = new StdSchedulerFactory().getScheduler();
scheduler.start();
scheduler.scheduleJob(job, trigger);
}
}
'Dev > Java' 카테고리의 다른 글
System.out 파일로 출력 (0) | 2013.12.11 |
---|---|
Spring 테스트 Log4j 초기화 (0) | 2013.12.11 |
jndi test 2 (0) | 2013.12.11 |
applicationContext.xml, sqlMapConfig, configLocation (classpath or file) (0) | 2013.12.09 |
@ContextConfiguration (0) | 2013.12.09 |
Comments