일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- import
- Eclipse
- 단축키
- find
- Source
- VirtualBox
- JavaScript
- tomcat
- Windows 10
- Windows
- xargs
- IntelliJ
- netsh
- context
- GIT
- plugin
- port
- vscode
- maVen
- lsof
- ssh
- grep
- profile
- 줄바꿈 문자
- Mac
- web.xml
- resource
- 네트워크
- bash
- Quartz
- Today
- Total
develog
Quartz - Defining a Job 본문
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");
'Dev > Java' 카테고리의 다른 글
poi 대용량 엑셀 write (0) | 2013.01.08 |
---|---|
Quartz job fire manually (0) | 2012.12.18 |
java get ip (0) | 2012.12.14 |
Apache Derby Eclipse plug-in (0) | 2012.12.08 |
Quartz cron expression test (0) | 2012.12.04 |