Defining a Job
---------------------------------------------------------------------------------
2.1.x
---------------------------------------------------------------------------------
// A Job Class
public class PrintPropsJob implements Job {
public PrintPropsJob() {
// Instances of Job must have a public no-argument constructor.
}
public void execute(JobExecutionContext context)
throws JobExecutionException {
JobDataMap data = context.getMergedJobDataMap();
System.out.println("someProp = " + data.getString("someProp"));
}
}
// Define job instance
JobDetail job1 = newJob(MyJobClass.class)
.withIdentity("job1", "group1")
.usingJobData("someProp", "someValue")
.build();
---------------------------------------------------------------------------------
2.0.x
---------------------------------------------------------------------------------
// A Job Class
public class PrintPropsJob implements Job {
public PrintPropsJob() {
// Instances of Job must have a public no-argument constructor.
}
public void execute(JobExecutionContext context)
throws JobExecutionException {
JobDataMap data = context.getMergedJobDataMap();
System.out.println("someProp = " + data.getString("someProp"));
}
}
// Define job instance
JobDetail job1 = newJob(MyJobClass.class)
.withIdentity("job1", "group1")
.usingJobData("someProp", "someValue")
.build();
---------------------------------------------------------------------------------
1.x
---------------------------------------------------------------------------------
// A Job Class
public class PrintPropsJob implements Job {
public PrintPropsJob() {
// Instances of Job must have a public no-argument constructor.
}
public void execute(JobExecutionContext context)
throws JobExecutionException {
JobDataMap data = context.getJobDetail().getJobDataMap();
System.out.println("someProp = " + data.getString("someProp"));
}
}
// Define job instance
JobDetail job = new JobDetail("job1", "group1", MyJobClass.class);
job.getDataMap().put("someProp", "someValue");
Log4j 설정..
#쿼츠 자체 로그
log4j.logger.org.quartz=ERROR
JOB 로그
출처 = http://hothoony.tistory.com/151
댓글
댓글 쓰기