| 方法名称 | 说明 |
|---|---|
| repeatMinutelyForever() | 设置为永远重复,间隔时间为1分钟 |
| repeatMinutelyForever(int minutes) | 设置为永远重复,间隔时间为参数设置的分钟数,例如,minutes=3,则每三分钟调度一次 |
| repeatSecondlyForever() | 设置为永远重复,间隔时间为1秒钟 |
| repeatSecondlyForever(int seconds) | 设置为永远重复,间隔时间为参数设置的秒数 |
| repeatHourlyForever() | 设置为永远重复,间隔时间为1小时 |
| repeatHourlyForever(int hours) | 设置为永远重复,间隔时间为设置的小时数 |
| repeatMinutelyForTotalCount(int count) | 设置参数为指定重复的次数,间隔实际为1分钟,例如,count=3,则每分钟执行一次,重复三次 |
| repeatMinutelyForTotalCount(int count, int minutes) | 设置间隔时间为minutes分钟,执行次数为count |
| repeatSecondlyForTotalCount(int count) | 设置参数为指定重复的次数,间隔时间为1秒钟 |
| repeatSecondlyForTotalCount(int count, int seconds) | 设置间隔时间为seconds秒,执行次数为count |
| repeatHourlyForTotalCount(int count) | 设置参数为指定重复的次数,间隔时间为1小时 |
| repeatHourlyForTotalCount(int count, int hours) | 设置间隔时间为hours小时,执行次数为count |
| withIntervalInMilliseconds(long intervalInMillis) | 设置重复间隔为intervalInMillis毫秒,当不设置重复次数时候默认只执行一次。例如:SimpleScheduleBuilder.simpleSchedule().withIntervalInMilliseconds(1000L).withRepeatCount(3);--设置重复间隔为1000毫秒,重复次数为(3+1)次。SimpleScheduleBuilder.simpleSchedule().withIntervalInMilliseconds(1000L); --设置重复间隔为1000毫秒,重复次数为默认值1次 |
| withIntervalInSeconds(int intervalInSeconds) | 设置重复间隔为intervalInSeconds秒,当不设置重复次数时候默认只执行一次。例如:SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(4).withRepeatCount(2);--设置重复间隔为4秒,重复次数为(2+1)次。SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(4);--设置重复次数间隔为4秒,重复次数为默认值1次 |
| withIntervalInMinutes(int intervalInMinutes) | 设置重复间隔为intervalInMinutes分钟,当不设置重复次数时候默认只执行一次。例如:SimpleScheduleBuilder.simpleSchedule().withIntervalInMinutes(1).withRepeatCount(2);--设置重复间隔为1分钟,重复次数为(2+1)次。SimpleScheduleBuilder.simpleSchedule().withIntervalInMinutes(1);--设置重复次数间隔为1分钟,重复次数为默认值1次 |
| withIntervalInHours(int intervalInHours) | 设置重复间隔为intervalInHours小时,当不设置重复次数时候默认只执行一次。例如:SimpleScheduleBuilder.simpleSchedule().withIntervalInHours(1).withRepeatCount(2);--设置重复间隔为1小时,重复次数为(2+1)次。SimpleScheduleBuilder.simpleSchedule().withIntervalInHours(1);--设置重复次数间隔为1小时,重复次数为默认值1次 |
| withRepeatCount(int triggerRepeatCount) | 设置重复次数为triggerRepeatCount次,配合withIntervalInXxx使用(不能单独使用,不设置间隔时间时候报错);例如:SimpleScheduleBuilder.simpleSchedule().withRepeatCount(5).withIntervalInMinutes(1);--设置重复次数为(5+1)次,重复间隔时间为1分钟。SimpleScheduleBuilder.simpleSchedule().withRepeatCount(5);--未设置间隔时间,报错 |
| repeatForever() | 设置为一直重复,配合withIntervalInXxx使用(不能单独使用,不设置间隔时间时候报错);例如:SimpleScheduleBuilder.simpleSchedule().repeatForever().withIntervalInMinutes(1);--设置为一直重复,重复间隔时间为1分钟。SimpleScheduleBuilder.simpleSchedule().repeatForever();--未设置间隔时间,报错 |
| withMisfireHandlingInstructionIgnoreMisfires() | 始终是到原来的结束时间就结束。重新计算执行次数,misfire后当前的执行立即触发。例如,结束时间是18:00,执行次数是5次,17:45时出现misfire,17:50时候恢复, |
| withMisfireHandlingInstructionFireNow() | 只要发生misfire就会延迟结束时间。例如,19:19:40 执行完之后发生misfire,19:20:03才开始恢复,最近的一次执行应该在19:20:00,相差3秒,这就是延迟的时间差。 |
| withMisfireHandlingInstructionNextWithExistingCount() | 无论是否发生misfire,到原来的结束时间就结束。 |
| withMisfireHandlingInstructionNextWithRemainingCount() | 无论是否发生misfire,到原来的结束时间就结束。 |
| withMisfireHandlingInstructionNowWithExistingCount() | 只要发生misfire,重新执行(初始次数 + 重复执行次数)之和 |
| withMisfireHandlingInstructionNowWithRemainingCount() | 无论发生misfire与否,执行次数一定是之前设定的。 |
版权声明:本文为Yingtaozi_0原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。