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 | 31 |
Tags
- lsof
- profile
- Quartz
- Source
- IntelliJ
- Eclipse
- 단축키
- maVen
- JavaScript
- VirtualBox
- grep
- tomcat
- 네트워크
- find
- xargs
- import
- netsh
- GIT
- vscode
- Windows
- context
- bash
- port
- web.xml
- Mac
- 줄바꿈 문자
- ssh
- resource
- plugin
- Windows 10
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