package Ġcom . bre un inger . boot . jobs Ċ Ċ import Ġcom . bre un inger . boot . jobs . domain . Job Ċ import Ġcom . bre un inger . boot . jobs . repository . Job Executor Registry Ċ import Ġcom . bre un inger . boot . jobs . service . Job Execution Service Ċ import Ġcom . bre un inger . boot . jobs . service . JobService Ċ import Ġio . micro meter . core . instrument . Meter Registry Ċ import Ġorg . springframework . boot . autoconfigure . condition . Conditional On Property Ċ import Ġorg . springframework . context . Application Event Publisher Ċ import Ġorg . springframework . scheduling . annotation . Scheduling Configurer Ċ import Ġorg . springframework . scheduling . config . Cron Task Ċ import Ġorg . springframework . scheduling . config . Fixed Delay Task Ċ import Ġorg . springframework . scheduling . config . Fixed Rate Task Ċ import Ġorg . springframework . scheduling . config . Scheduled Task Registrar Ċ import Ġorg . springframework . stereotype . Component Ċ import Ġjava . util . concurrent . Scheduled ExecutorService Ċ Ċ @ Component Ċ @ Conditional On Property ( prefix Ġ= Ġ" bre uni . jobs ", Ġname Ġ= Ġ[" enabled "], Ġhaving Value Ġ= Ġ" true ") Ċ class ĠJob Registrar ( ĊĠ Ġprivate Ġval Ġjob Run n ables : ĠList < Job Runnable > ?, ĊĠ Ġprivate Ġval Ġjob Service : ĠJob Service , ĊĠ Ġprivate Ġval Ġjob Execution Service : ĠJob Execution Service , ĊĠ Ġprivate Ġval Ġevent Publisher : ĠApplication Event Publisher , ĊĠ Ġprivate Ġval Ġscheduled ExecutorService : ĠScheduled ExecutorService , ĊĠ Ġprivate Ġval Ġmeter Registry : ĠMeter Registry , ĊĠ Ġprivate Ġval Ġjob Executor Registry : ĠJob Executor Registry Ċ ) Ġ: ĠS cheduling Configurer Ġ{ ĊĊĠ Ġoverride Ġfun Ġconfigure Tasks ( task Registrar : ĠScheduled Task Registrar ) Ġ{ ĊĠĠĠ Ġjob Run n ables ?. map Ġ{ ĊĠĠĠĠĠ Ġval Ġjob Definition Ġ= Ġit . definition () ĊĠĠĠĠĠ Ġjob Service . create ( Job ( job Definition . jobId )) ĊĠĠĠĠĠ Ġval Ġjob Executor Ġ= ĠJob Executor ( it , Ġjob Execution Service , Ġevent Publisher , Ġscheduled ExecutorService , Ġmeter Registry ) ĊĠĠĠĠĠ Ġjob Executor Registry . register ( job Definition . jobId , Ġjob Executor ) ĊĠĠĠĠĠ Ġjob Definition . cron ?. let Ġ{ Ġcron Ġ-> ĊĠĠĠĠĠĠĠ Ġtask Registrar . add Cron Task ( Cron Task ( job Executor , Ġcron )) ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġjob Definition . fixed Delay ?. let Ġ{ Ġfixed Delay Ġ-> ĊĠĠĠĠĠĠĠ Ġtask Registrar . add Fixed Delay Task ( Fixed Delay Task ( job Executor , Ġfixed Delay . to Millis (), Ġfixed Delay . to Millis ())) ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġjob Definition . fixed Rate ?. let Ġ{ Ġfixed Rate Ġ-> ĊĠĠĠĠĠĠĠ Ġtask Registrar . add Fixed Rate Task ( Fixed Rate Task ( job Executor , Ġfixed Rate . to Millis (), Ġfixed Rate . to Millis ())) ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ