An option for SimpleAsyncTaskExecutor to throw an exception when limit is reached #34727
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Hello,
Use-case:
@Async @Retryable
task that may fail (e.g. during an incident).@Async
tasks.@Async
method (without blocking the caller or failing the caller).Using default
SimpleAsyncTaskExecutor
withconcurrencyLimit
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 someTaskRejectedException
when limit is reached instead of blocking the caller?The text was updated successfully, but these errors were encountered: