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

    Nested classes/interfaces inherited from interface org.opensearch.common.xcontent.ToXContent

    org.opensearch.common.xcontent.ToXContent.DelegatingMapParams, org.opensearch.common.xcontent.ToXContent.MapParams, org.opensearch.common.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.opensearch.common.io.stream.Writeable

    org.opensearch.common.io.stream.Writeable.Reader<V extends java.lang.Object>, org.opensearch.common.io.stream.Writeable.Writer<V extends java.lang.Object>
  • Field Summary

    Fields inherited from interface org.opensearch.jobscheduler.spi.schedule.Schedule

    DELAY_FIELD

    Fields inherited from interface org.opensearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • 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
    boolean equals​(java.lang.Object o)  
    java.lang.Long getDelay()
    Gets the delay parameter of the schedule.
    int getInterval()  
    java.time.Instant getNextExecutionTime​(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 at startTime.
    java.time.Instant getStartTime()  
    java.time.temporal.ChronoUnit getUnit()  
    int hashCode()  
    java.time.Duration nextTimeToExecute()
    Calculates the time duration between next execution time and now.
    java.lang.Boolean runningOnTime​(java.time.Instant lastExecutionTime)
    Returns if the job is running on time.
    java.lang.String toString()  
    org.opensearch.common.xcontent.XContentBuilder toXContent​(org.opensearch.common.xcontent.XContentBuilder builder, org.opensearch.common.xcontent.ToXContent.Params params)  
    void writeTo​(org.opensearch.common.io.stream.StreamOutput out)  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.opensearch.common.xcontent.ToXContentObject

    isFragment
  • 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: Schedule
      Gets the delay parameter of the schedule.
      Specified by:
      getDelay in interface Schedule
      Returns:
      the delay parameter of the schedule as a Long.
    • getNextExecutionTime

      public java.time.Instant getNextExecutionTime​(java.time.Instant time)
      Description copied from interface: Schedule
      Gets next job execution time of given time parameter.
      Specified by:
      getNextExecutionTime in interface Schedule
      Parameters:
      time - base time point
      Returns:
      next execution time since time parameter.
    • nextTimeToExecute

      public java.time.Duration nextTimeToExecute()
      Description copied from interface: Schedule
      Calculates the time duration between next execution time and now.
      Specified by:
      nextTimeToExecute in interface Schedule
      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: Schedule
      Gets the execution period starting at startTime.
      Specified by:
      getPeriodStartingAt in interface Schedule
      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: Schedule
      Returns if the job is running on time.
      Specified by:
      runningOnTime in interface Schedule
      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:
      toXContent in interface org.opensearch.common.xcontent.ToXContent
      Throws:
      java.io.IOException
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • writeTo

      public void writeTo​(org.opensearch.common.io.stream.StreamOutput out) throws java.io.IOException
      Specified by:
      writeTo in interface org.opensearch.common.io.stream.Writeable
      Throws:
      java.io.IOException