Skip to content
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

ConcurrentTaskScheduler and ConcurrentTaskExecutor can create an executor with no way to shut it down #27914

Closed
snicoll opened this issue Jan 11, 2022 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented Jan 11, 2022

There is a default constructor of both on these that creates a default executor. When the application shuts down, there's no way to shut down the executor as it isn't exposed.

We probably may want to enforce the wrapping feature instead and deprecate both constructors.

@snicoll snicoll added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 11, 2022
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Apr 25, 2022
@rstoyanchev rstoyanchev added this to the Triage Queue milestone Apr 25, 2022
@jhoeller jhoeller added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 14, 2022
@jhoeller jhoeller self-assigned this Jun 14, 2022
@jhoeller jhoeller modified the milestones: Triage Queue, 6.0.x Jun 14, 2022
@jhoeller jhoeller modified the milestones: 6.0.x, 6.1.x Jan 11, 2023
@jhoeller jhoeller modified the milestones: 6.1.x, 6.1.0-M1 Mar 22, 2023
mdeinum pushed a commit to mdeinum/spring-framework that referenced this issue Jun 29, 2023
Includes revision of null Executor configuration.
Respects TaskDecorator configuration on DefaultManagedTaskExecutor.

Closes spring-projectsgh-27914
snicoll added a commit that referenced this issue Dec 8, 2023
While it is not easily possible to create a ConcurrentTaskScheduler
with no scheduled executor, DefaultManagedTaskScheduler has a default
constructor that does that as the JNDI lookup happens in the regular
afterPropertiesSet callback. If such an instance is created manually,
it can throw an unhelpful NullPointerException if one attempts to
schedule a task.

This commit updates ConcurrentTaskScheduler to flag that the scheduled
executor could be `null` and check if that's the case before using it.
This now throws a dedicated exception that should hopefully provide
better context for those upgrading.

See gh-27914

Closes gh-31751
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants