i have job uploads data ftp,and needs end before starts again.so result have used disallowconcurrentexecution attribute class.now problem when job finished doesn't wait x seconds until starts again.for example:
ischedulerfactory schedfact = new stdschedulerfactory(); ischeduler sched = schedfact.getscheduler(); sched.start(); ijobdetail job = jobbuilder.create<hellojob>() .withidentity("myjob", "group1") .build(); itrigger trigger = triggerbuilder.create() .withidentity("mytrigger", "group1") .startnow() .withsimpleschedule(x => x .withintervalinseconds(5) .repeatforever() .withmisfirehandlinginstructionnextwithremainingcount()) .build(); sched.schedulejob(job, trigger); }} [disallowconcurrentexecution] public class hellojob : ijob { public void execute(ijobexecutioncontext context) { console.writeline("start"); thread.sleep(5000); console.writeline("end"); } }
this job starts,does 5 secs , ends.however quartz starts next job since has counted 5 seconds the job started. how can achieve start job - 5 secs - end - wait 5 secs - start again- ... behavior quartz.net?
you can create chain of jobs, instead of forever repeating job. @ end of execution of job, schedule execute in 5 seconds.
Comments
Post a Comment