Package com.sodius.oslc.server.core.jobs
Class Jobs
java.lang.Object
com.sodius.oslc.server.core.jobs.Jobs
Provide helper functions to describe job configurations and validate schedules.
- Since:
- 3.11.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic JobSchedulercreateScheduler(UnaryOperator<JobRunner> runnerAdapter) Creates a scheduler that uses the given function to adapt the execution of jobs.static StringgetDescription(String jobDescription, JobSchedule schedule) Returns a description combining the given short description and the job schedule.static Function<JobSchedule, String> Returns a function rejecting jobs scheduled with a fixed delay.static Function<JobSchedule, String> Returns a function rejecting jobs scheduled at a fixed rate.
-
Method Details
-
createScheduler
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
Returns a description combining the given short description and the job schedule. This method shall be used in aconfig providerto 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
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
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:
-