0

Hi I have a scheduled job to run every hours in Quartz.net:

 private static void InitTimers() {
        log.Info("InitTimers");
        try {
            var job = Quartz.JobBuilder.Create<HourlyJob>()
               .WithIdentity("HourlyJob")
               .Build();
            var trigger = Quartz.TriggerBuilder.Create()
                .WithIdentity("HourlyTrigger")
                .StartAt(Quartz.DateBuilder.EvenHourDateAfterNow())
                .WithSchedule(Quartz.SimpleScheduleBuilder.RepeatHourlyForever())
                .Build();
            _scheduler.ScheduleJob(job, trigger);
        } catch (Exception ex) {
            log.Error("InitTimers", ex);
        }
    }

and I am calling it from static class ApplicationServer:

var schedulerFactory = new Quartz.Impl.StdSchedulerFactory();
_scheduler = schedulerFactory.GetScheduler();
 _scheduler.Start();
InitTimers();

_scheduler is a static field as well. My server is running on Windows Server 2008 R2 and jobs are always stopping after 8 hours. I've read that it might be because of GC, but in this case I am not really sure what I should do. Any other ideas

Update: So I went through logs and found out that it always stops at 6 pm. What might be the reason that I should look for?

kali
  • 109
  • 1
  • 2
  • 9

1 Answers1

0

I have nearly the same code for one of mein project and it works, but ich add the job before start scheduler. Try

var schedulerFactory = new Quartz.Impl.StdSchedulerFactory();
_scheduler = schedulerFactory.GetScheduler();
InitTimers();
_scheduler.Start();

Did you get an exception when it stop?

  • I dont have any exceptions. I builded up log and nothing shows up there as well - it just stops – kali Jan 30 '15 at 07:54