Package com.google.gerrit.server.config
Class ScheduleConfig
java.lang.Object
com.google.gerrit.server.config.ScheduleConfig
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
and startTime
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 ClassesModifier and TypeClassDescriptionstatic class
static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ScheduleConfig.Builder
static Optional<ScheduleConfig.Schedule>
createSchedule
(org.eclipse.jgit.lib.Config config, String section) schedule()
final String
toString()
-
Constructor Details
-
ScheduleConfig
public ScheduleConfig()
-
-
Method Details
-
createSchedule
public static Optional<ScheduleConfig.Schedule> createSchedule(org.eclipse.jgit.lib.Config config, String section) -
builder
-
schedule
-
toString
-