Пример #1
0
 private static void ExecuteJob(Action<ISchedulingService> setupHandler, string jobName)
 {
     try
     {
         using (var service = new SchedulingService())
         {
             setupHandler(service);
             service.ExecuteNamedJob(jobName);
         }
     }
     catch (Exception ex)
     {
         Console.Error.WriteLine(ex);
     }
 }
Пример #2
0
 public ServiceProcessAdapter(SchedulingService service)
 {
     _service = service;
 }
Пример #3
0
 protected CronJobTestsBase()
 {
     _systemClock = new SystemClock(new DateTime(2012, 1, 1));
     SystemTime.Resolver = () => _systemClock.UtcNow;
     _schedulingService = new SchedulingService();
 }
Пример #4
0
 private static void Schedule(SchedulingService schedulingService) {
     schedulingService.At("*/1 * * * *").Run<SeparateProcessCronJob>().Named("out-of-process");
     schedulingService.At("*/1 * * * *").Run(() => new InProcessCronJob());
 }
Пример #5
0
 internal JobPart(SchedulingService service, ScheduledJob queueEntry)
 {
     _service = service;
     _queueEntry = queueEntry;
 }
Пример #6
0
        private static void RunService(Action<ISchedulingService> setupHandler, bool debug)
        {
            try
            {
                AppDomain.CurrentDomain.UnhandledException +=
                    (o, e) => ExceptionHelper.LogUnhandledException(e.ExceptionObject);

                using (var service = new SchedulingService())
                {
                    setupHandler(service);

                    if (debug)
                    {
                        service.Start();
                        Console.ReadLine();
                        service.Stop();
                    }
                    else
                    {
                        using (var adapter = new ServiceProcessAdapter(service))
                        {
                            ServiceBase.Run(adapter);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHelper.LogUnhandledException(exception);
            }
        }
Пример #7
0
 public ServiceProcessAdapter(SchedulingService service)
 {
     _service = service;
 }