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