Announcement Announcement Module
Collapse
No announcement yet.
quartz reuse cron triggers Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • quartz reuse cron triggers

    Hi Guys,

    I am using quartz and in the process of creating some persistant jobs. I have 4 job types
    Daily Reports
    Nightly Reports
    Weekly Reports
    Monthly Reports

    This will mean i will have 4 cron triggers corresponding to the frequence of the report.


    Ideally when i create a new JobDetail i would ideally like to re-use the cron triggers. e.g i might have 100 daily reports. Can i not just reference an existing cron trigger for daily reports?

    Code:
    	JobDetail jobDetail = new JobDetail("report3", "DailyReport", ReportJob.class);
    		jobDetail.setJobDataMap(dataMap);
    
    cTrigger = (CronTrigger)scheduler.getTrigger("DailyReport", "DailyReport");
    		cTrigger.setJobName("report3");
    		scheduler.scheduleJob(jobDetail,cTrigger);
    When i try and schedule job, i get

    Code:
    org.quartz.ObjectAlreadyExistsException: Unable to store Trigger with name: 'DailyReport' and group: 'DailyReport', because one already exists with this identification.
    So for each job i create must i create a new CronTrigger for each?
Working...
X