true.
Note that the TaskScheduler interface already defines methods for scheduling tasks at fixed-rate or with fixed-delay. Both also support an optional value for the initial delay. Those methods should be used directly whenever possible. The value of this Trigger implementation is that it can be used within components that rely on the Trigger abstraction. For example, it may be convenient to allow periodic triggers, cron-based triggers, and even custom Trigger implementations to be used interchangeably.
| Modifier and Type | Field and Description |
|---|---|
| private final ChronoUnit | |
| private volatile boolean | |
| private volatile Duration | |
| private final Duration |
| Access | Constructor and Description |
|---|---|
| public | PeriodicTrigger(long period)
Deprecated
since 6.0. as of 6.0, in favor on
PeriodicTrigger(Duration)
Create a trigger with the given period in milliseconds. |
| public | PeriodicTrigger(long period, TimeUnit timeUnit)
Deprecated
since 6.0. as of 6.0, in favor on
PeriodicTrigger(Duration)
Create a trigger with the given period and time unit. |
| public | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. Indicates whether some other object is "equal to" this one. |
| public long | getInitialDelay()
Deprecated
since 6.0. as of 6.0, in favor on
getInitialDelayDuration()
Return the initial delay, or 0 if none. |
| public Duration | |
| public long | getPeriod()
Deprecated
since 6.0. as of 6.0, in favor on
getPeriodDuration()
Return this trigger's period. |
| public Duration | |
| public TimeUnit | getTimeUnit()
Deprecated
since 6.0. as of 6.0, with no direct replacement
Return this trigger's time unit (milliseconds by default). |
| public int | |
| public boolean | |
| public Instant | nextExecution(TriggerContext
context object encapsulating last execution times
and last completion time triggerContext)Implements org. Returns the time after which a task should run again. |
| public void | setFixedRate(boolean fixedRate)
Specify whether the periodic interval should be measured between the scheduled start times rather than between actual completion times. |
| public void | setInitialDelay(long initialDelay)
Deprecated
since 6.0. as of 6.0, in favor of
setInitialDelay(Duration)
Specify the delay for the initial execution. |
| public void | |
| private static Duration |
| chronoUnit | back to summary |
|---|---|
| private final ChronoUnit chronoUnit
| |
| fixedRate | back to summary |
|---|---|
| private volatile boolean fixedRate | |
| initialDelay | back to summary |
|---|---|
| private volatile Duration initialDelay
| |
| period | back to summary |
|---|---|
| private final Duration period | |
| PeriodicTrigger | back to summary |
|---|---|
| public PeriodicTrigger(long period)
Create a trigger with the given period in milliseconds.
| |
| PeriodicTrigger | back to summary |
|---|---|
| public PeriodicTrigger(long period, TimeUnit timeUnit)
Create a trigger with the given period and time unit. The time unit will
apply not only to the period but also to any 'initialDelay' value, if
configured on this Trigger later via
| |
| PeriodicTrigger | back to summary |
|---|---|
| public PeriodicTrigger(Duration period) Create a trigger with the given period as a duration.
| |
| PeriodicTrigger | back to summary |
|---|---|
| private PeriodicTrigger(Duration period, TimeUnit timeUnit) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getInitialDelay | back to summary |
|---|---|
| public long getInitialDelay()
Return the initial delay, or 0 if none.
| |
| getInitialDelayDuration | back to summary |
|---|---|
| public Duration getInitialDelayDuration() Return the initial delay, or
| |
| getPeriod | back to summary |
|---|---|
| public long getPeriod()
Return this trigger's period.
| |
| getPeriodDuration | back to summary |
|---|---|
| public Duration getPeriodDuration() Return this trigger's period.
| |
| getTimeUnit | back to summary |
|---|---|
| public TimeUnit getTimeUnit()
Deprecated since 6.0. as of 6.0, with no direct replacement Return this trigger's time unit (milliseconds by default).
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isFixedRate | back to summary |
|---|---|
| public boolean isFixedRate() Return whether this trigger uses fixed rate (
| |
| nextExecution | back to summary |
|---|---|
| public Instant nextExecution(TriggerContext triggerContext) Implements org. Returns the time after which a task should run again.
| |
| setFixedRate | back to summary |
|---|---|
| public void setFixedRate(boolean fixedRate) Specify whether the periodic interval should be measured between the scheduled start times rather than between actual completion times. The latter, "fixed delay" behavior, is the default. | |
| setInitialDelay | back to summary |
|---|---|
| public void setInitialDelay(long initialDelay)
Specify the delay for the initial execution. It will be evaluated in
terms of this trigger's
| |
| setInitialDelay | back to summary |
|---|---|
| public void setInitialDelay(Duration initialDelay) Specify the delay for the initial execution.
| |
| toDuration | back to summary |
|---|---|
| private static Duration toDuration(long amount, TimeUnit timeUnit) | |