类 AsyncSupportConfigurer
- java.lang.Object
- org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer
public class AsyncSupportConfigurer extends Object
Helps with configuring options for asynchronous request processing.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 AsyncSupportConfigurer()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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)
Set the defaultAsyncTaskExecutor
to use when a controller method returns aCallable
.
构造器详细资料
AsyncSupportConfigurer
public AsyncSupportConfigurer()
方法详细资料
setTaskExecutor
public AsyncSupportConfigurer setTaskExecutor(AsyncTaskExecutor taskExecutor)
Set the defaultAsyncTaskExecutor
to use when a controller method returns aCallable
. Controller methods can override this default on a per-request basis by returning aWebAsyncTask
.By default a
SimpleAsyncTaskExecutor
instance is used, and it's highly recommended to change that default in production since the simple executor does not re-use threads.- 参数:
taskExecutor
- the task executor instance to use by default
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, e.g. 10 seconds on Tomcat with Servlet 3.
- 参数:
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
.- 参数:
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
.- 参数:
interceptors
- the interceptors to register
getTaskExecutor
protected AsyncTaskExecutor getTaskExecutor()
getTimeout
protected Long getTimeout()
getCallableInterceptors
protected List<CallableProcessingInterceptor> getCallableInterceptors()
getDeferredResultInterceptors
protected List<DeferredResultProcessingInterceptor> getDeferredResultInterceptors()