开发者

Disable Quartz startup on first scheduale

开发者 https://www.devze.com 2023-02-10 07:20 出处:网络
I am using Quartz as followed: schedulerFactory 开发者_如何学C= new StdSchedulerFactory(); scheduler = schedulerFactory.getScheduler();

I am using Quartz as followed:

 schedulerFactory 开发者_如何学C= new StdSchedulerFactory();
    scheduler = schedulerFactory.getScheduler();
    JobDetail startECMSJob = new JobDetail("startECMSJob", "group1", StartECMSJob.class);       
    Trigger trigger = TriggerUtils.makeMinutelyTrigger(30); 
    trigger.setName("TriggersGroup1");
    trigger.setGroup("group1");
    scheduler.scheduleJob(startECMSJob, trigger);
    scheduler.start();

Problem is that Quartz starting straight away on deploy. I do want it to start only 30 mins after deploy. same thign when I rescehduale it. I dont want it to start straight away as it rescheduale.

rescheduale code:

    //JobDetail startECMSJob = new JobDetail("startECMSJob", "group1", StartECMSJob.class);
        JobDetail jobDetail=jobContext.getJobDetail();      
        Trigger trigger = TriggerUtils.makeSecondlyTrigger(30); 
        trigger.setName("aa");
        trigger.setGroup("group1");
        trigger.setJobName(jobContext.getJobDetail().getName());
        trigger.setJobGroup(jobContext.getJobDetail().getGroup());
        Scheduler scheduler = jobContext.getScheduler();        
        scheduler.rescheduleJob("TriggersGroup1", "group1", trigger);

any idea how can i choose the first trigger? thanks, ray.


trigger.setStartTime(new Date(System.currentTimeMillis() + 30 * 60 * 1000));
0

精彩评论

暂无评论...
验证码 换一张
取 消