public abstract class IntervalJobSchedule extends Object implements JobSchedule
| Modifier and Type | Class and Description |
|---|---|
static class |
IntervalJobSchedule.Builder |
JobSchedule.FallbackSchedule| Modifier and Type | Field and Description |
|---|---|
static String |
FIELD_INTERVAL |
static String |
FIELD_UNIT |
static String |
TYPE_NAME |
TYPE_FIELD| Constructor and Description |
|---|
IntervalJobSchedule() |
| Modifier and Type | Method and Description |
|---|---|
static IntervalJobSchedule.Builder |
builder() |
Optional<org.joda.time.DateTime> |
calculateNextTime(org.joda.time.DateTime lastExecutionTime,
org.joda.time.DateTime lastNextTime)
Calculates the next time a job should be executed based on the schedule implementation.
|
abstract @Min(value=1L) long |
interval() |
abstract IntervalJobSchedule.Builder |
toBuilder() |
Optional<Map<String,Object>> |
toDBUpdate(String fieldPrefix)
Returns a map with the schedule data.
|
abstract TimeUnit |
unit() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittypepublic static final String TYPE_NAME
public static final String FIELD_INTERVAL
public static final String FIELD_UNIT
@Min(value=1L) public abstract @Min(value=1L) long interval()
public abstract TimeUnit unit()
public Optional<org.joda.time.DateTime> calculateNextTime(org.joda.time.DateTime lastExecutionTime, org.joda.time.DateTime lastNextTime)
JobScheduleOptional, there will be no next execution time. (e.g. for one-off jobs)
The lastExecutionTime parameter is the last execution time of the trigger. This can be used to detect
if the trigger has been executed way later than the lastNextTime.
The lastNextTime parameter is the last nextTime of the job trigger. This can be used to
calculate the new next time. Using the previous nextTime as base for the new one is more accurate than
using the current time. (e.g. because of delayed execution and job duration)
calculateNextTime in interface JobSchedulelastExecutionTime - the last execution time of a triggerlastNextTime - the base time, chosen by the caller (mostly last nextTime)public Optional<Map<String,Object>> toDBUpdate(String fieldPrefix)
JobScheduleJacksonDBCollection#update())toDBUpdate in interface JobSchedulefieldPrefix - the field prefix to use for the map keypublic static IntervalJobSchedule.Builder builder()
public abstract IntervalJobSchedule.Builder toBuilder()
Copyright © 2012–2021 Graylog, Inc.. All rights reserved.