diff --git a/spring-context/src/main/java/org/springframework/scheduling/support/PeriodicTrigger.java b/spring-context/src/main/java/org/springframework/scheduling/support/PeriodicTrigger.java index 401fbe8b6d..6e9537389d 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/support/PeriodicTrigger.java +++ b/spring-context/src/main/java/org/springframework/scheduling/support/PeriodicTrigger.java @@ -74,6 +74,22 @@ public class PeriodicTrigger implements Trigger { } + /** + * Return this trigger's period. + * @since 5.0.2 + */ + public long getPeriod() { + return this.period; + } + + /** + * Return this trigger's time unit (milliseconds by default). + * @since 5.0.2 + */ + public TimeUnit getTimeUnit() { + return this.timeUnit; + } + /** * Specify the delay for the initial execution. It will be evaluated in * terms of this trigger's {@link TimeUnit}. If no time unit was explicitly @@ -83,6 +99,14 @@ public class PeriodicTrigger implements Trigger { this.initialDelay = this.timeUnit.toMillis(initialDelay); } + /** + * Return the initial delay, or 0 if none. + * @since 5.0.2 + */ + public long getInitialDelay() { + return this.initialDelay; + } + /** * Specify whether the periodic interval should be measured between the * scheduled start times rather than between actual completion times. @@ -92,6 +116,15 @@ public class PeriodicTrigger implements Trigger { this.fixedRate = fixedRate; } + /** + * Return whether this trigger uses fixed rate ({@code true}) or + * fixed delay ({@code false}) behavior. + * @since 5.0.2 + */ + public boolean isFixedRate() { + return this.fixedRate; + } + /** * Returns the time after which a task should run again.