public class CountTrigger
extends java.lang.Object
implements org.springframework.scheduling.Trigger
PeriodicTrigger
except also adding a counter how many times a trigger can fire. If given
count is either zero on a negative value, counter functionality is disabled.PeriodicTrigger
Constructor and Description |
---|
CountTrigger(int count,
long period,
long initialDelay,
java.util.concurrent.TimeUnit timeUnit)
Create a trigger with the given count, period and time unit.
|
CountTrigger(int count,
long period,
java.util.concurrent.TimeUnit timeUnit)
Create a trigger with the given count, period and time unit.
|
CountTrigger(long period)
Create a trigger with the given period in milliseconds and firing
exactly one time.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
java.util.Date |
nextExecutionTime(org.springframework.scheduling.TriggerContext triggerContext) |
void |
setFixedRate(boolean fixedRate)
Specify whether the periodic interval should be measured between the
scheduled start times rather than between actual completion times.
|
void |
setInitialDelay(long initialDelay)
Specify the delay for the initial execution.
|
public CountTrigger(long period)
period
- the periodpublic CountTrigger(int count, long period, java.util.concurrent.TimeUnit timeUnit)
setInitialDelay(long)
.count
- the countperiod
- the periodtimeUnit
- the time unitpublic CountTrigger(int count, long period, long initialDelay, java.util.concurrent.TimeUnit timeUnit)
setInitialDelay(long)
.count
- the countperiod
- the periodtimeUnit
- the time unitinitialDelay
- the initial delaypublic void setInitialDelay(long initialDelay)
TimeUnit
. If no time unit was explicitly
provided upon instantiation, the default is milliseconds.initialDelay
- the new initial delaypublic void setFixedRate(boolean fixedRate)
fixedRate
- the new fixed ratepublic java.util.Date nextExecutionTime(org.springframework.scheduling.TriggerContext triggerContext)
nextExecutionTime
in interface org.springframework.scheduling.Trigger
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object