use of org.apache.openejb.resource.quartz.QuartzResourceAdapter in project tomee by apache.
the class JobBean method createJob.
@Override
public Date createJob() throws Exception {
final QuartzResourceAdapter ra = (QuartzResourceAdapter) new InitialContext().lookup("java:openejb/Resource/QuartzResourceAdapter");
final Scheduler s = ra.getScheduler();
//Add a job type
final JobDetail jd = JobBuilder.newJob(MyTestJob.class).withIdentity("job1", "group1").build();
jd.getJobDataMap().put("MyJobKey", "MyJobValue");
//Schedule my 'test' job to run now
final SimpleTrigger trigger = TriggerBuilder.newTrigger().withIdentity("trigger1", "group1").forJob(jd).withSchedule(SimpleScheduleBuilder.simpleSchedule().withRepeatCount(0).withIntervalInSeconds(0)).build();
return s.scheduleJob(jd, trigger);
}
Aggregations