I am trying to update the quartz job scheduling dynamically:
Initially it is after every 3 minute, but dynamically i want to make it 1 min.
here's my quartz.xml and java file
quartz.xml
<schedule>
<job>
<name>JOBNAME</name>
<group>GroupDummy</group>
<description>This is Job B</description>
<job-class>in.xyz.MyClass.java</job-class>
</job>
<trigger>
<cron>
<name>dummyTriggerNameB</name>
<group>MYTRIGGER_GROUP</group>
<job-name>JOBNAME</job-name>
<job-group>GroupDummy</job-group>
<cron-expression>0 0/3 * * * ?</cron-expression>
</cron>
</trigger>
</schedule>
MyClass.java
public void execute(JobExecutionContext arg0) throws JobExecutionException {
Scheduler scheduler = new StdSchedulerFactory().getScheduler();
CronTrigger cronTrigger = (CronTrigger) scheduler.getTrigger("dummyTriggerNameB", "MYTRIGGER_GROUP");
CronExpression cronExpression = new CronExpression("0 0/1 * * * ?");
cronTrigger.setCronExpression(cronExpression);
scheduler.rescheduleJob("dummyTriggerNameB", "MYTRIGGER_GROUP", cronTrigger);
}
I am trying the above java code to change the time from 3 minute to 1 minute dynamically but it is not happening "cronTrigger" is returning null.
Help to solve this problem so that i can reschedule dynamically.