Tobias Montagna-Hay opened SPR-13506 and commented
Would it be possible to modify the creation of the ScheduledTaskRegistrar to be a Spring managed bean in the ScheduledAnnotationBeanProcessor?
The reason for this is so that tasks that have been scheduled using the @Scheduled
annotation can also be inspected.
Access has previously been made available to tasks that have been scheduled using the task xml prefix. #17345
I have submitted a pull request here: https://github.com/spring-projects/spring-framework/pull/878
Affects: 4.2.1
Reference URL: http://stackoverflow.com/questions/21791853/how-are-spring-taskscheduled-objects-represented-at-runtime/28753723#28753723
Issue Links: - #17345 Allowing access to scheduled tasks in the ScheduledTaskRegistrar
6 votes, 9 watchers
Comment From: spring-projects-issues
MECH commented
Even if ScheduledTaskRegistrar is available as Spring Bean, the lazy creation of the List<*Task> instances would be annoying for introspection as one would need to cope with NPEs. So that should be fixed, too.
Additionally even if one can get the list of cronTasks the getTrigger().nextExecutionTime(triggerContext) is not easily accessible. There's no (good) way to get the triggerContext yet as this seems to be created inside TaskSchedulers via (new) ReschedulingRunnable and new SimpleTriggerContext.
Guess there's more reasoning required to allow simlar introspection features for @Scheduled
as for plain Quartz configurations.
Comment From: spring-projects-issues
Tamas commented
This is not done, right?
Using spring 4.3.5 and ScheduledTaskRegistrar is not a bean, but only available through SchedulingConfigurer that has an instance available as a parameter. That instance is instantiated through ScheduledAnnotationBeanPostProcessor where it is a private final variable.
Comment From: jhoeller
This is effectively superseded by #21374 in combination with #20532. While that internal ScheduledTaskRegistrar
is still not exposed as a bean itself, it can be provided on ScheduledAnnotationBeanPostProcessor
construction, and there is a common ScheduledTaskHolder
interface which allows for introspecting the tasks of that internal ScheduledTaskRegistrar
as well.
Comment From: sbrannen
Superseded by:
-
21374
-
20532