Class Jobs

java.lang.Object
com.sodius.oslc.server.core.jobs.Jobs

public class Jobs extends Object
Provide helper functions to describe job configurations and validate schedules.
Since:
3.11.0
  • Method Details

    • createScheduler

      public static JobScheduler createScheduler(UnaryOperator<JobRunner> runnerAdapter)
      Creates a scheduler that uses the given function to adapt the execution of jobs. The adapter can typically be used by an application to apply pre or post handling, for example when running background jobs requires additional care compared to regular requests with an authenticated user.
      Parameters:
      runnerAdapter - the function adapting a given job runner
      Returns:
      a scheduler using the adapter to execute jobs
    • getDescription

      public static String getDescription(String jobDescription, JobSchedule schedule)
      Returns a description combining the given short description and the job schedule. This method shall be used in a config provider to assign a description on a job configuration.
      Parameters:
      jobDescription - a short description of the job, e.g. "Repairing all TRS feeds"
      schedule - the job schedule
      Returns:
      a description including schedule information
      Since:
      3.12.0
      See Also:
    • rejectFixedRateSchedule

      public static Function<JobSchedule,String> rejectFixedRateSchedule()
      Returns a function rejecting jobs scheduled at a fixed rate.
      Returns:
      a function to reject jobs scheduled at a fixed rate.
      Since:
      3.12.0
      See Also:
    • rejectFixedDelaySchedule

      public static Function<JobSchedule,String> rejectFixedDelaySchedule()
      Returns a function rejecting jobs scheduled with a fixed delay.
      Returns:
      a function to reject jobs scheduled with a fixed delay.
      Since:
      3.12.0
      See Also: