-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: enhancementA general enhancementA general enhancement
Milestone
Description
Jean-Baptiste Nizet opened SPR-12189 and commented
ScheduledAnnotationBeanPostProcessor scans the methods of all the beans created by Spring for @Scheduled
annotations. But this also includes, in a web application, all the request- and session-scoped beans, created long after the context has been started and the tasks have been scheduled.
It thus has two implications:
- if a Scheduled annotation is placed on a request-scoped bean (stupid, I know), a new Runnable is created at each request, referencing the request-scoped bean, and placed in a list of the registrar, which causes a big memory leak
- several classes are needlessly scanned at each request for nothing if request-scoped beans are used in the application, consituting a loss of performance, that grows with the number of request-scoped beans used.
A flag could be set to true as soon as afterSingletonsInstantiated() has been called, and the postProcessAfterInitialization() method would do nothing if this flag is set.
Affects: 3.2.11, 4.0.7, 4.1 GA
Issue Links:
- @Scheduled no longer works in case of multiple proxied target classes implementing the same interface [SPR-12709] #17306
@Scheduled
no longer works in case of multiple proxied target classes implementing the same interface - ScheduledAnnotationBeanPostProcessor should unregister tasks on destruction of individual beans [SPR-12216] #16830 ScheduledAnnotationBeanPostProcessor should unregister tasks on destruction of individual beans
- Scheduled/JmsListenerAnnotationBeanPostProcessor free heap space [SPR-15175] #19741 Scheduled/JmsListenerAnnotationBeanPostProcessor free heap space
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: enhancementA general enhancementA general enhancement