Modifier and Type | Class and Description |
---|---|
class |
Schedule.NextDateTimeFinder
Helper class to actually do the work of finding the next run time.
|
Modifier and Type | Field and Description |
---|---|
static int |
FRIDAY |
static int |
MONDAY |
static int |
SATURDAY |
static int |
SUNDAY |
static int |
THURSDAY |
static int |
TUESDAY |
static int |
WEDNESDAY |
Constructor and Description |
---|
Schedule() |
Modifier and Type | Method and Description |
---|---|
static Schedule |
daily()
Get a schedule instance that will run every night, at some random minute
during the 5AM hour
|
Schedule |
daysBiweekly(Long startingAt,
DayOfWeek... days)
Runs the given days of the week, every other week.
|
Schedule |
daysOfMonth(Integer... daysOfMonth)
Set the days of the month on which the schedule is to run.
|
Schedule |
daysOfWeek(DayOfWeek... days)
Set the days of the week on which the task is to run.
|
Schedule |
daysOfWeekMonth(DayOfWeek dayOfWeek,
Integer... weeksOfMonth)
Set the day of the week and which weeks of the month combination
the schedule is to match.
|
Schedule |
everyDay()
Set the task to run every single day
|
Schedule |
everyHour()
Set the task to run each hour of the day
|
Schedule |
everyMinute()
Set the schedule to run every minute
|
Schedule |
everyMonth()
Runs every month
|
ZoneId |
getZoneId() |
static Schedule |
hourly()
Run at the top of every hour
|
Schedule |
hours(Integer... hours)
Set which hours of the day the task should run at
|
boolean |
matchesDateTime(ZonedDateTime dt)
Returns true if this schedule matches the passed in datetime
|
Schedule |
minutes(Integer... minutes)
Set which minutes of the hour the task will run at
|
Schedule |
months(Integer... months)
Set to runs on the given month(s)
|
ZonedDateTime |
nextAt()
Gets the next datetime matching the schedule, in the Users timezone
|
ZonedDateTime |
nextAt(ZonedDateTime startingFrom)
Gets the next datetime matching the schedule, passing in the current
date from which to look.
|
static Schedule |
paydays()
Get a schedule instance that will run on at 5AM UTC on the second and fourth Friday, every month
|
Schedule |
randomMinute()
Set the schedule to run on a random minute every hour
|
ZonedDateTime |
serverLocalNextAt()
Gets the next datetime matching the schedule, in the application timezone, as defined in the settings
|
Schedule |
timezone(String timeZoneId) |
ZonedDateTime |
utcNextAt()
Gets the next datetime matching the schedule, in UTC
|
Schedule |
verify()
Verify that this is a valid schedule.
|
public static final int MONDAY
public static final int TUESDAY
public static final int WEDNESDAY
public static final int THURSDAY
public static final int FRIDAY
public static final int SATURDAY
public static final int SUNDAY
public Schedule()
public ZonedDateTime nextAt()
public ZonedDateTime utcNextAt()
public ZonedDateTime serverLocalNextAt()
public ZonedDateTime nextAt(ZonedDateTime startingFrom)
startingFrom
- public boolean matchesDateTime(ZonedDateTime dt)
dt
- public static Schedule daily()
public static Schedule paydays()
public Schedule minutes(Integer... minutes)
minutes
- public Schedule everyMinute()
public Schedule randomMinute()
public Schedule hours(Integer... hours)
hours
- public Schedule daysOfMonth(Integer... daysOfMonth)
daysOfMonth
- public Schedule daysOfWeek(DayOfWeek... days)
days
- public Schedule daysOfWeekMonth(DayOfWeek dayOfWeek, Integer... weeksOfMonth)
dayOfWeek
- weeksOfMonth
- public Schedule daysBiweekly(Long startingAt, DayOfWeek... days)
startingAt
- days
- public Schedule everyMonth()
public Schedule months(Integer... months)
months
- public Schedule verify() throws ConfigException
ConfigException
Copyright © 2016. All rights reserved.