Class IntervalSchedule
java.lang.Object
org.opensearch.jobscheduler.spi.schedule.IntervalSchedule
- All Implemented Interfaces:
org.opensearch.common.io.stream.Writeable,org.opensearch.common.xcontent.ToXContent,org.opensearch.common.xcontent.ToXContentObject,Schedule
public class IntervalSchedule extends java.lang.Object implements Schedule
Schedule defined by interval (interval value & interval unit). Currently the finest unit supported is minute.-
Nested Class Summary
-
Field Summary
-
Constructor Summary
Constructors Constructor Description IntervalSchedule(java.time.Instant startTime, int interval, java.time.temporal.ChronoUnit unit)IntervalSchedule(java.time.Instant startTime, int interval, java.time.temporal.ChronoUnit unit, long scheduleDelay)IntervalSchedule(org.opensearch.common.io.stream.StreamInput input) -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.LonggetDelay()Gets the delay parameter of the schedule.intgetInterval()java.time.InstantgetNextExecutionTime(java.time.Instant time)Gets next job execution time of given time parameter.org.opensearch.common.collect.Tuple<java.time.Instant,java.time.Instant>getPeriodStartingAt(java.time.Instant startTime)Gets the execution period starting atstartTime.java.time.InstantgetStartTime()java.time.temporal.ChronoUnitgetUnit()inthashCode()java.time.DurationnextTimeToExecute()Calculates the time duration between next execution time and now.java.lang.BooleanrunningOnTime(java.time.Instant lastExecutionTime)Returns if the job is running on time.java.lang.StringtoString()org.opensearch.common.xcontent.XContentBuildertoXContent(org.opensearch.common.xcontent.XContentBuilder builder, org.opensearch.common.xcontent.ToXContent.Params params)voidwriteTo(org.opensearch.common.io.stream.StreamOutput out)
-
Constructor Details
-
IntervalSchedule
public IntervalSchedule(java.time.Instant startTime, int interval, java.time.temporal.ChronoUnit unit) -
IntervalSchedule
public IntervalSchedule(java.time.Instant startTime, int interval, java.time.temporal.ChronoUnit unit, long scheduleDelay) -
IntervalSchedule
public IntervalSchedule(org.opensearch.common.io.stream.StreamInput input) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Details
-
getStartTime
public java.time.Instant getStartTime() -
getInterval
public int getInterval() -
getUnit
public java.time.temporal.ChronoUnit getUnit() -
getDelay
public java.lang.Long getDelay()Description copied from interface:ScheduleGets the delay parameter of the schedule. -
getNextExecutionTime
public java.time.Instant getNextExecutionTime(java.time.Instant time)Description copied from interface:ScheduleGets next job execution time of given time parameter.- Specified by:
getNextExecutionTimein interfaceSchedule- Parameters:
time- base time point- Returns:
- next execution time since time parameter.
-
nextTimeToExecute
public java.time.Duration nextTimeToExecute()Description copied from interface:ScheduleCalculates the time duration between next execution time and now.- Specified by:
nextTimeToExecutein interfaceSchedule- Returns:
- time duration between next execution and now.
-
getPeriodStartingAt
public org.opensearch.common.collect.Tuple<java.time.Instant,java.time.Instant> getPeriodStartingAt(java.time.Instant startTime)Description copied from interface:ScheduleGets the execution period starting atstartTime.- Specified by:
getPeriodStartingAtin interfaceSchedule- Parameters:
startTime- start time of the period.- Returns:
- the start time and end time of the period in the tuple.
-
runningOnTime
public java.lang.Boolean runningOnTime(java.time.Instant lastExecutionTime)Description copied from interface:ScheduleReturns if the job is running on time.- Specified by:
runningOnTimein interfaceSchedule- Parameters:
lastExecutionTime- last execution time.- Returns:
- true if the job executes on time, otherwise false.
-
toXContent
public org.opensearch.common.xcontent.XContentBuilder toXContent(org.opensearch.common.xcontent.XContentBuilder builder, org.opensearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceorg.opensearch.common.xcontent.ToXContent- Throws:
java.io.IOException
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
writeTo
public void writeTo(org.opensearch.common.io.stream.StreamOutput out) throws java.io.IOException- Specified by:
writeToin interfaceorg.opensearch.common.io.stream.Writeable- Throws:
java.io.IOException
-