Package com.google.gerrit.server.config
Class ScheduleConfig
- java.lang.Object
-
- com.google.gerrit.server.config.ScheduleConfig
-
public abstract class ScheduleConfig extends Object
This class reads a schedule for running a periodic background job from a Git config.A schedule configuration consists of two parameters:
interval
: Interval for running the periodic background job. The interval must be larger than zero. The following suffixes are supported to define the time unit for the interval:s
,sec
,second
,seconds
m
,min
,minute
,minutes
h
,hr
,hour
,hours
d
,day
,days
w
,week
,weeks
(1 week
is treated as7 days
)mon
,month
,months
(1 month
is treated as30 days
)y
,year
,years
(1 year
is treated as365 days
)
startTime
: The start time defines the first execution of the periodic background job. If the configuredinterval
is shorter thanstartTime - now
the start time will be preponed by the maximum integral multiple ofinterval
so that the start time is still in the future.startTime
must have one of the following formats:<day of week> <hours>:<minutes>
<hours>:<minutes>
<day of week>
:Mon
,Tue
,Wed
,Thu
,Fri
,Sat
,Sun
<hours>
:00
-23
<minutes>
:00
-59
The section and the subsection from which the
interval
andstartTime
parameters are read can be configured.Examples for a schedule configuration:
-
foo.startTime = Fri 10:30 foo.interval = 2 day
Assuming that the server is started onMon 7:00
thenstartTime - now
is4 days 3:30 hours
. This is larger than the interval hence the start time is preponed by the maximum integral multiple of the interval so that start time is still in the future, i.e. preponed by 4 days. This yields a start time ofMon 10:30
, next executions areWed 10:30
,Fri 10:30
. etc. -
foo.startTime = 06:00 foo.interval = 1 day
Assuming that the server is started onMon 7:00
then this yields the first run on next Tuesday at 6:00 and a repetition interval of 1 day.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ScheduleConfig.Builder
static class
ScheduleConfig.Schedule
-
Constructor Summary
Constructors Constructor Description ScheduleConfig()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ScheduleConfig.Builder
builder(org.eclipse.jgit.lib.Config config, String section)
static Optional<ScheduleConfig.Schedule>
createSchedule(org.eclipse.jgit.lib.Config config, String section)
Optional<ScheduleConfig.Schedule>
schedule()
String
toString()
-
-
-
Method Detail
-
createSchedule
public static Optional<ScheduleConfig.Schedule> createSchedule(org.eclipse.jgit.lib.Config config, String section)
-
builder
public static ScheduleConfig.Builder builder(org.eclipse.jgit.lib.Config config, String section)
-
schedule
@Memoized public Optional<ScheduleConfig.Schedule> schedule()
-
-