Class SchedulerExtension

java.lang.Object
dev.relism.flash.ext.scheduler.SchedulerExtension
All Implemented Interfaces:
dev.relism.flash.extension.FlashExtension

public final class SchedulerExtension extends Object implements dev.relism.flash.extension.FlashExtension
Installs the Scheduler.

 FlashApp.create(8080)
     .install(new SchedulerExtension())
     .apply(new BlogApp())
     .start();
 

No configuration beyond an optional shutdown grace period. The scheduler starts with the app and stops with it: shutdown is registered through FlashContext.onClose(java.lang.Runnable), so app.stop() drains in-flight requests first, then gives running jobs their grace period before forcing them down. Without that a job would outlive the app that owns it.

ponytail: schedules are per-instance. Two replicas run every job twice. The fix is a distributed lock, and it should not exist until there is a second replica.

  • Constructor Details

    • SchedulerExtension

      public SchedulerExtension()
    • SchedulerExtension

      public SchedulerExtension(Duration shutdownGrace)
      Parameters:
      shutdownGrace - how long stop() waits for running jobs before forcing them
  • Method Details

    • configure

      public void configure(dev.relism.flash.extension.FlashRegistrar<?> app, dev.relism.flash.extension.FlashContext ctx)
      Specified by:
      configure in interface dev.relism.flash.extension.FlashExtension