I have a couple of tasks scheduled within Spring's task scheduler:
<task:scheduled-tasks>
<task:scheduled ref="task1" method="run"
cron="0 0 */0 * * *" />
<task:scheduled ref="task2" method="run"
cron="0 0 */30 * * *" />
</task:scheduled-tasks>
<task:scheduler id="scheduler" pool-size="10" />
How can I access a list of scheduled tasks and retrieve meta-information (e.g the next execution time) from within the application context?
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
ThreadPoolTaskScheduler scheduler = (ThreadPoolTaskScheduler)context.getBean("scheduler");
//... how to continue from here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…