develog

quartz 본문

Dev/Java

quartz

냐옴 2013. 9. 5. 14:08

quartz 버전

Quartz 2.2.0 full distribution 


jar 파일

lib/log4j-1.2.16.jar

lib/quartz-2.2.0.jar

lib/slf4j-api-1.6.6.jar

lib/slf4j-log4j12-1.6.6.jar 


TestMain.java

import org.quartz.CronTrigger;

import org.quartz.Job;

import org.quartz.JobDetail;

import org.quartz.JobExecutionContext;

import org.quartz.JobExecutionException;

import org.quartz.Scheduler;

import org.quartz.SchedulerFactory;

import org.quartz.impl.StdSchedulerFactory;


import static org.quartz.JobBuilder.*;

import static org.quartz.TriggerBuilder.*;

import static org.quartz.CronScheduleBuilder.*;


public class TestMain implements Job {


public static void main(String[] args) throws Exception {

try {

JobDetail job = newJob(TestMain.class)

.withIdentity("job1", "group1")

.build();

CronTrigger trigger = newTrigger()

.withIdentity("trigger1", "group1")

.startNow()

.withSchedule(cronSchedule("0/1 * * * * ?"))

.build();

SchedulerFactory sf = new StdSchedulerFactory();

Scheduler scheduler = sf.getScheduler();

scheduler.scheduleJob(job, trigger);

scheduler.start();

} finally {

}


}


@Override

public void execute(JobExecutionContext arg0) throws JobExecutionException {

System.out.println(">> TestMain.execute()");

}


}

 


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

POI 정리  (0) 2013.10.16
quartz, Cron Expressions  (0) 2013.09.05
Apache Derby 설치  (0) 2013.08.24
java file copy test  (0) 2013.08.21
[Maven] pom.xml  (0) 2013.08.13
Comments