Quartz scheduler executes jobExecuted method for each repeat trigger

Viewed 12

This is a job scheduler code

JobDetail job = JobBuilder.newJob()
                .ofType( AppJob.class )
                .withIdentity("id", "jobgroup")
                .setJobData(jobDataMap)
                .build();

        Trigger trigger = TriggerBuilder.newTrigger()
                .withIdentity("trigger_id", "jobGroup")
                .startAt( start.getTime() )
                .withSchedule(
                        SimpleScheduleBuilder.simpleSchedule()
                                .withIntervalInSeconds(1).repeatForever())
                .endAt( end.getTime() )
                .build();

And the listener

scheduler.getListenerManager().addJobListener(new JobListener() {
                @Override
                public String getName() {
                    return "ffdfd";
                }

                @Override
                public void jobToBeExecuted(JobExecutionContext jobExecutionContext) {

                }

                @Override
                public void jobExecutionVetoed(JobExecutionContext jobExecutionContext) {

                }

                @Override
                public void jobWasExecuted(JobExecutionContext jobExecutionContext, JobExecutionException e) {
                    System.out.println(" fdfnkdfkndfnkldnnl OVERRR ");
                }
            }, KeyMatcher.keyEquals(jobKey(String.valueOf(id), "jobGroup")));

As this is the repeated event, the jobWasExecuted method executes every time for the repeat interval

How to get one final complete event for this job

0 Answers
Related