It should be pretty simple, but I donβt see the work being done. I have a breakpoint on the execute () method of the task, the thread does not appear anywhere. I'm not wrong.
The task
class Printer implements Job{ public Printer(){ System.out.println("created printer"); } @Override public void execute(JobExecutionContext context) throws JobExecutionException { System.out.println("hi" + context.getFireTime()); } }
Main class
class MyClass { public static void main(String[] args) throws Throwable { Scheduler s = StdSchedulerFactory.getDefaultScheduler(); JobDetail job = newJob(Printer.class).build(); CronTrigger trigger = newTrigger() .withIdentity("a", "t") .withSchedule(cronSchedule("0/5 * * * * ?").inTimeZone(TimeZone.getDefault())) .forJob(job).build(); s.scheduleJob(job, trigger);
EDIT : I found that I did not have a quartz.property file, so it was possible that threadpool for quartz was never created. Therefore, as read in the documentation , I replaced the code using StdSchedulerFactory with the following text:
DirectSchedulerFactory.getInstance().createVolatileScheduler(10); Scheduler s = DirectSchedulerFactory.getInstance().getScheduler();
Guess what? Bad luck. The same effect. The application remains alive, the shooting does not work.
sscarduzio
source share