Update WebMvc docs on use of AsyncTaskExecutor
Closes gh-30905
This commit is contained in:
@@ -22,9 +22,7 @@ import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptor;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
import org.springframework.web.context.request.async.DeferredResultProcessingInterceptor;
|
||||
@@ -49,15 +47,15 @@ public class AsyncSupportConfigurer {
|
||||
|
||||
|
||||
/**
|
||||
* The provided task executor is used to:
|
||||
* The provided task executor is used for the following:
|
||||
* <ol>
|
||||
* <li>Handle {@link Callable} controller method return values.
|
||||
* <li>Perform blocking writes when streaming to the response
|
||||
* through a reactive (e.g. Reactor, RxJava) controller method return value.
|
||||
* </ol>
|
||||
* <p>By default only a {@link SimpleAsyncTaskExecutor} is used. However when
|
||||
* using the above two use cases, it's recommended to configure an executor
|
||||
* backed by a thread pool such as {@link ThreadPoolTaskExecutor}.
|
||||
* <p>If your application has controllers with such return types, please
|
||||
* configure an {@link AsyncTaskExecutor} as the one used by default is not
|
||||
* suitable for production under load.
|
||||
* @param taskExecutor the task executor instance to use by default
|
||||
*/
|
||||
public AsyncSupportConfigurer setTaskExecutor(AsyncTaskExecutor taskExecutor) {
|
||||
|
||||
@@ -399,9 +399,9 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
* Set the default {@link AsyncTaskExecutor} to use when a controller method
|
||||
* return a {@link Callable}. Controller methods can override this default on
|
||||
* a per-request basis by returning an {@link WebAsyncTask}.
|
||||
* <p>By default a {@link SimpleAsyncTaskExecutor} instance is used.
|
||||
* It's recommended to change that default in production as the simple executor
|
||||
* does not re-use threads.
|
||||
* <p>If your application has controllers with such return types, please
|
||||
* configure an {@link AsyncTaskExecutor} as the one used by default is not
|
||||
* suitable for production under load.
|
||||
*/
|
||||
public void setTaskExecutor(AsyncTaskExecutor taskExecutor) {
|
||||
this.taskExecutor = taskExecutor;
|
||||
|
||||
Reference in New Issue
Block a user