Class AsyncSupportConfigurer
- java.lang.Object
- org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer
public class AsyncSupportConfigurer extends Object
Helps with configuring options for asynchronous request processing.- Since:
- 3.2
- Author:
- Rossen Stoyanchev
Constructor Summary
Constructors Constructor Description AsyncSupportConfigurer()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<CallableProcessingInterceptor>
getCallableInterceptors()
protected List<DeferredResultProcessingInterceptor>
getDeferredResultInterceptors()
protected AsyncTaskExecutor
getTaskExecutor()
protected Long
getTimeout()
AsyncSupportConfigurer
registerCallableInterceptors(CallableProcessingInterceptor... interceptors)
Configure lifecycle interceptors with callbacks around concurrent request execution that starts when a controller returns aCallable
.AsyncSupportConfigurer
registerDeferredResultInterceptors(DeferredResultProcessingInterceptor... interceptors)
Configure lifecycle interceptors with callbacks around concurrent request execution that starts when a controller returns aDeferredResult
.AsyncSupportConfigurer
setDefaultTimeout(long timeout)
Specify the amount of time, in milliseconds, before asynchronous request handling times out.AsyncSupportConfigurer
setTaskExecutor(AsyncTaskExecutor taskExecutor)
The provided task executor is used to: HandleCallable
controller method return values.
Constructor Detail
AsyncSupportConfigurer
public AsyncSupportConfigurer()
Method Detail
setTaskExecutor
public AsyncSupportConfigurer setTaskExecutor(AsyncTaskExecutor taskExecutor)
The provided task executor is used to:- Handle
Callable
controller method return values. - Perform blocking writes when streaming to the response through a reactive (e.g. Reactor, RxJava) controller method return value.
By default only a
SimpleAsyncTaskExecutor
is used. However when using the above two use cases, it's recommended to configure an executor backed by a thread pool such asThreadPoolTaskExecutor
.- Parameters:
taskExecutor
- the task executor instance to use by default
- Handle
setDefaultTimeout
public AsyncSupportConfigurer setDefaultTimeout(long timeout)
Specify the amount of time, in milliseconds, before asynchronous request handling times out. In Servlet 3, the timeout begins after the main request processing thread has exited and ends when the request is dispatched again for further processing of the concurrently produced result.If this value is not set, the default timeout of the underlying implementation is used.
- Parameters:
timeout
- the timeout value in milliseconds
registerCallableInterceptors
public AsyncSupportConfigurer registerCallableInterceptors(CallableProcessingInterceptor... interceptors)
Configure lifecycle interceptors with callbacks around concurrent request execution that starts when a controller returns aCallable
.- Parameters:
interceptors
- the interceptors to register
registerDeferredResultInterceptors
public AsyncSupportConfigurer registerDeferredResultInterceptors(DeferredResultProcessingInterceptor... interceptors)
Configure lifecycle interceptors with callbacks around concurrent request execution that starts when a controller returns aDeferredResult
.- Parameters:
interceptors
- the interceptors to register
getTaskExecutor
@Nullable protected AsyncTaskExecutor getTaskExecutor()
getTimeout
@Nullable protected Long getTimeout()
getCallableInterceptors
protected List<CallableProcessingInterceptor> getCallableInterceptors()
getDeferredResultInterceptors
protected List<DeferredResultProcessingInterceptor> getDeferredResultInterceptors()