Package org.graylog.scheduler.schedule
Class OnceJobSchedule
java.lang.Object
org.graylog.scheduler.schedule.OnceJobSchedule
- All Implemented Interfaces:
JobSchedule
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.graylog.scheduler.JobSchedule
JobSchedule.FallbackSchedule -
Field Summary
FieldsFields inherited from interface org.graylog.scheduler.JobSchedule
TYPE_FIELD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OnceJobSchedule.Builderbuilder()Optional<org.joda.time.DateTime>calculateNextTime(org.joda.time.DateTime lastExecutionTime, org.joda.time.DateTime lastNextTime, JobSchedulerClock clock) Calculates the next time a job should be executed based on the schedule implementation.static OnceJobSchedulecreate()abstract OnceJobSchedule.BuildertoDBUpdate(String fieldPrefix) Returns a map with the schedule data.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.graylog.scheduler.JobSchedule
type
-
Field Details
-
TYPE_NAME
- See Also:
-
-
Constructor Details
-
OnceJobSchedule
public OnceJobSchedule()
-
-
Method Details
-
calculateNextTime
public Optional<org.joda.time.DateTime> calculateNextTime(org.joda.time.DateTime lastExecutionTime, org.joda.time.DateTime lastNextTime, JobSchedulerClock clock) Description copied from interface:JobScheduleCalculates the next time a job should be executed based on the schedule implementation. If this returns an emptyOptional, there will be no next execution time. (e.g. for one-off jobs)The
lastExecutionTimeparameter is the last execution time of the trigger. This can be used to detect if the trigger has been executed way later than thelastNextTime.The
lastNextTimeparameter is the lastnextTimeof the job trigger. This can be used to calculate the new next time. Using the previousnextTimeas base for the new one is more accurate than using the current time. (e.g. because of delayed execution and job duration)- Specified by:
calculateNextTimein interfaceJobSchedule- Parameters:
lastExecutionTime- the last execution time of a triggerlastNextTime- the base time, chosen by the caller (mostly last nextTime)- Returns:
- filled optional with the next execution time, empty optional if there is no next execution time
-
toDBUpdate
Description copied from interface:JobScheduleReturns a map with the schedule data. This can be used to update a MongoDB document with schedule data. (seeJacksonDBCollection#update())- Specified by:
toDBUpdatein interfaceJobSchedule- Parameters:
fieldPrefix- the field prefix to use for the map key- Returns:
- filled optional with a map, empty optional if there is no update data
-
create
-
builder
-
toBuilder
-