Example #1
0
 protected override void ServiceStop()
 {
     // Stop the plan follower
     if (scheduledExecutorService != null && !scheduledExecutorService.IsShutdown())
     {
         scheduledExecutorService.Shutdown();
     }
     // Clear the plans
     plans.Clear();
 }
Example #2
0
 public virtual void Schedule <_T0>(Callable <_T0> callable, long delay, long interval
                                    , TimeUnit unit)
 {
     Check.NotNull(callable, "callable");
     if (!scheduler.IsShutdown())
     {
         Log.Debug("Scheduling callable [{}], interval [{}] seconds, delay [{}] in [{}]",
                   new object[] { callable, delay, interval, unit });
         Runnable r = new _Runnable_98(this, callable);
         scheduler.ScheduleWithFixedDelay(r, delay, interval, unit);
     }
     else
     {
         throw new InvalidOperationException(MessageFormat.Format("Scheduler shutting down, ignoring scheduling of [{}]"
                                                                  , callable));
     }
 }