Class Jobs


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

      • 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,
                                            List<Locale> locales)
        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
        locales - the locales to use, in decreasing order starting with the preferred locale
        Returns:
        a description including schedule information
        See Also:
        Job.Builder.configProvider(BiFunction)