Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added "repeatCount" bean property to Quartz SimpleTriggerFactoryBean

Issue: SPR-9521
  • Loading branch information...
commit 5a7b3f65ec244088583cf822d5478cf1d1632d38 1 parent fdb9de1
@jhoeller jhoeller authored
View
3  spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerFactoryBean.java
@@ -145,10 +145,9 @@ public void setJobDataAsMap(Map<String, ?> jobDataAsMap) {
* Set the start delay in milliseconds.
* <p>The start delay is added to the current system time (when the bean starts)
* to control the start time of the trigger.
- * @param startDelay the start delay, in milliseconds
*/
public void setStartDelay(long startDelay) {
- Assert.state(startDelay >= 0, "Start delay cannot be negative.");
+ Assert.isTrue(startDelay >= 0, "Start delay cannot be negative");
this.startDelay = startDelay;
}
View
16 spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java
@@ -82,6 +82,8 @@
private long repeatInterval;
+ private int repeatCount = -1;
+
private int priority;
private int misfireInstruction;
@@ -143,10 +145,9 @@ public void setJobDataAsMap(Map<String, ?> jobDataAsMap) {
* Set the start delay in milliseconds.
* <p>The start delay is added to the current system time (when the bean starts)
* to control the start time of the trigger.
- * @param startDelay the start delay, in milliseconds
*/
public void setStartDelay(long startDelay) {
- Assert.state(startDelay >= 0, "Start delay cannot be negative.");
+ Assert.isTrue(startDelay >= 0, "Start delay cannot be negative");
this.startDelay = startDelay;
}
@@ -158,6 +159,14 @@ public void setRepeatInterval(long repeatInterval) {
}
/**
+ * Specify the number of times this trigger is supposed to fire.
+ * <p>Default is to repeat indefinitely.
+ */
+ public void setRepeatCount(int repeatCount) {
+ this.repeatCount = repeatCount;
+ }
+
+ /**
* Specify the priority of this trigger.
*/
public void setPriority(int priority) {
@@ -216,6 +225,7 @@ else if (this.startTime == null) {
sti.setJobDataMap(this.jobDataMap);
sti.setStartTime(this.startTime);
sti.setRepeatInterval(this.repeatInterval);
+ sti.setRepeatCount(this.repeatCount);
sti.setPriority(this.priority);
sti.setMisfireInstruction(this.misfireInstruction);
this.simpleTrigger = sti;
@@ -248,7 +258,7 @@ else if (this.startTime == null) {
pvs.add("jobDataMap", this.jobDataMap);
pvs.add("startTime", this.startTime);
pvs.add("repeatInterval", this.repeatInterval);
- pvs.add("repeatCount", -1);
+ pvs.add("repeatCount", this.repeatCount);
pvs.add("priority", this.priority);
pvs.add("misfireInstruction", this.misfireInstruction);
bw.setPropertyValues(pvs);
Please sign in to comment.
Something went wrong with that request. Please try again.