New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support initial delay attribute for @Scheduled and <task:scheduled> [SPR-7022] #11684
Comments
Dan Checkoway commented Attached is a patch that should work. I'm pretty new to contributing to Spring Framework, so I'm honestly not too sure how to build it. But hopefully you'll be able to give this a shot. The idea is that instead of using Map<Runnable, Long> to convey the task configuration to the ScheduledTaskRegistrar, it uses Lists with new objects CronTask, FixedDelayTask, and FixedRateTask. The latter two are able to store both the initialDelay and fixedDelay or fixedRate, respectively. |
Oliver Siegmar commented Please note, that this support should also be added to the scheduled element in Spring's task namespace -
|
Timo Rumland commented I vote for this. The "initialDelay" was one of the first things I looked for when I started using the <task:scheduled.. /> tags. I use annotations heavily, but configuring scheduled service methods is one of the few things I really like doing in XML to keep the overview. |
Tristan Burch commented I'd love to see annotation and namespace support for this! |
Ryan Tenney commented Any chance we could get this in 3.1.1? |
Tristan Burch commented Maybe it can be fixed in 3.1.2 or even 3.2M1? |
Chris Beams commented "Scheduled" for 3.2 M1, pun intended :)
|
Paul Khodchenkov commented Absence of initial-delay parameter often cause the deadlock on startup |
Chris Beams commented Available now in 3.2.0.BUILD-SNAPSHOT via repo.springsource.org. See here if you haven't dealt with snapshots before. Enjoy!
|
Dan Checkoway opened SPR-7022 and commented
@Scheduled
is the coolest thing ever...but it could really use an "initialDelay" parameter. Otherwise there's no way (that I'm aware of) to configure a@Scheduled
method to run after a specified delay.Without it, I'm forced to use the likes of TaskScheduler.scheduleAtFixedRate(Runnable, Date, long) and pass it a startDate...and then I'm forced to wrap a Runnable around my method, etc. That's so old school! :-)
Anyway, please consider my humble request for an optional "initialDelay" such as:
@Scheduled
(fixedRate=60000,initialDelay=20000)and
@Scheduled
(fixedDelay=30000,initialDelay=30000)Attachments:
Issue Links:
Referenced from: commits 5330c52, 53673d6
25 votes, 24 watchers
The text was updated successfully, but these errors were encountered: