-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed
Closed
Copy link
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Hello,
Use-case:
- We have an
@Async @Retryabletask that may fail (e.g. during an incident). - If it fails, we retry N times for M seconds.
- Given N, M and RPS, there can be hundred thousands of pending
@Asynctasks. - We would like to limit concurrency by several thousands, and reject over-limit tasks without affecting a caller of
@Asyncmethod (without blocking the caller or failing the caller). - We would like to use Virtual Threads.
Using default SimpleAsyncTaskExecutor with concurrencyLimit is not an option as it blocks the caller when limit is reached.
Using ThreadPoolExecutor with Virtual Threads is an option, but it is considered an anti-pattern.
Another option is not to use @Async, but just use virtual threads with a semaphore for example.
Is it possible to implement an option for SimpleAsyncTaskExecutor to throw some TaskRejectedException when limit is reached instead of blocking the caller?
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement