Interface ITimePropertiesBuilder
interface ITimePropertiesBuilder
Extends com.amazon.apmf.IStandard
The ITimePropertiesBuilder allows callers to create an instance
ITimeProperties. The constraint can be a combination of a delay or start time, an
execution window and a repetition interval. A time window defines a specific start time and a
duration inside of which task execution must begin.
Methods
startDelay()
Set an initial delay for the start of the task execution. This value is a lower bound i.e. the actual delay may be longer based on the resource availability. This method is incompatible withITimePropertiesBuilder*startDelay(com.amazon.apmf.MonotonicDurationminimumDelay)
startTime. Only one of them may be set when building an
ITimeProperties object. The start delay is expressed as a relative MonotonicDuration.
Task requests are evaluated based on system uptime, so clock syncs do not impact execution
readiness. However, a downside is that it is not possible to retain the delay countdown
across a power cycle.
Parameters
minimumDelay
com.amazon.apmf.MonotonicDuration — Required
The minimum initial delay expressed as a MonotonicDuration.
Returns
ITimePropertiesBuilder*
An ITimePropertiesBuilder instance that can be used for further calls.
startTime()
Set the earliest time when the task is eligible for execution. The start time is expressed as a point in time in the future based on the real-time clock. New and existing tasks are not evaluated for execution until a time sync occurs. Existing task requests are scheduled to run at a certain unix timestamp per the system clock. If the system time jumps ahead, every task that is eligible based on the new system clock will be executed. If the task is scheduled to run in the past, it will be eligible to run immediately. The actual execution time may be later based on resource availability. All task requests with absolute timestamps are evaluated based on UTC time. This method is incompatible withITimePropertiesBuilder*startTime(com.amazon.apmf.RealTimeInstantstart)
startDelay. Only one of them may be set when building an
ITimeProperties object.
Parameters
start
com.amazon.apmf.RealTimeInstant — Required
Start time of the execution time window expressed as a RealTimeInstant.
Returns
ITimePropertiesBuilder*
An ITimePropertiesBuilder instance that can be used for further calls.
executionWindow()
Set the length of the execution time window. This method must be used in conjunction withITimePropertiesBuilder*executionWindow(com.amazon.apmf.MonotonicDurationwindow)
startTime.
The execution window is expressed as an offset from the start time, where the lower bound
is the start time and the upper bound is the start time incremented by window.
The execution time window may not be smaller than 1 hour.
Parameters
window
com.amazon.apmf.MonotonicDuration — Required
The length of the execution time window expressed as a MonotonicDuration.
Returns
ITimePropertiesBuilder*
An ITimePropertiesBuilder instance that can be used for further calls.
repeatInterval()
Set a minimum interval to repeat task execution. Repeat interval is configured as offsets from the provided startTime or startDelay. Must be used in conjunction withITimePropertiesBuilder*repeatInterval(com.amazon.apmf.MonotonicDurationminimumRepeat)
ITaskRequestBuilder::repeating(). If the application requires an exact time elapse between
iterations, combine this method with startTime. As a result even when a single repetition
is delayed, subsequent repetitions will snap back to the original schedule and
not drift over time.
If combined with executionWindow,this will guarantee the time execution window will not
drift due to delays in any iteration. It is possible that the gap between individual
iterations is smaller than the minimumRepeat value.
The default behavior for repetition is that only one iteration may be outstanding at any
point in time. If a prior request is pending execution but delayed it is dropped when a
successive iteration becomes eligible for execution.
When used in conjunction with a configured time window, this API can be used allow the task
to execute every day within that time window. If used in conjunction with a configured time
window, the repeat interval MUST be a multiple of days.
Repetitions are based on the clock selected depending on whether startTime or startDelay
is specified. If using startTime, if the system clock jumps the next iteration will
execute at most once even if the repeat interval indicates it should run multiple times.
This also applies to tasks scheduled to run in the past.
Task manager attempts to minimize drift over successive repetitions due to delays in the
execution of the current iteration.
It is possible that the gap between individual iterations is smaller than the minimumRepeat value as
a result.
Parameters
minimumRepeat
com.amazon.apmf.MonotonicDuration — Required
The minimum repetition expressed as a MonotonicDuration.
Returns
ITimePropertiesBuilder*
An ITimePropertiesBuilder instance that can be used for further calls.
build()
Builds a ITimeProperties with the set parameters. Call this method after setting all parameters using the ‘set’ methods.ITimeProperties*build()
Returns
ITimeProperties*
A ITimeProperties instance to be provided to ITaskRequestBuilder.
Throws
com.amazon.apmf.InvalidArgumentError— If any set member variable is invalid.

