简体   繁体   中英

Issue with Spring Boot Async method

I have a asynchronous method enabled using @Async annotation. At times i am seeing SimpleAsyncTaskExecutor thread count increases exponentially. Any idea on this behavior?

如果它从字面上按指数级增长,这听起来像是异步方法正在调用自身?

By default, Spring uses a SimpleAsyncTaskExecutor to run the methods asynchronously. SimpleAsyncTaskExecutor spawns a new thread with each task and does not support thread pooling and queueing of tasks. So, if the async method is called multiple times in a short span of time, multiple threads will be opened for each task You should define your own executor. Refer the following link http://www.baeldung.com/spring-async

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM