Browse Source

Accessors for PeriodicTrigger properties

Issue: SPR-15982
pull/1594/head
Juergen Hoeller 8 years ago
parent
commit
85baba33bf
  1. 33
      spring-context/src/main/java/org/springframework/scheduling/support/PeriodicTrigger.java

33
spring-context/src/main/java/org/springframework/scheduling/support/PeriodicTrigger.java

@ -74,6 +74,22 @@ public class PeriodicTrigger implements Trigger { @@ -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 { @@ -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 { @@ -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.

Loading…
Cancel
Save