public class AsyncSupportConfigurer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.List<CallableProcessingInterceptor> |
callableInterceptors |
private java.util.List<DeferredResultProcessingInterceptor> |
deferredResultInterceptors |
private AsyncTaskExecutor |
taskExecutor |
private java.lang.Long |
timeout |
Constructor and Description |
---|
AsyncSupportConfigurer() |
Modifier and Type | Method and Description |
---|---|
protected java.util.List<CallableProcessingInterceptor> |
getCallableInterceptors() |
protected java.util.List<DeferredResultProcessingInterceptor> |
getDeferredResultInterceptors() |
protected AsyncTaskExecutor |
getTaskExecutor() |
protected java.lang.Long |
getTimeout() |
AsyncSupportConfigurer |
registerCallableInterceptors(CallableProcessingInterceptor... interceptors)
Configure lifecycle interceptors with callbacks around concurrent request
execution that starts when a controller returns a
Callable . |
AsyncSupportConfigurer |
registerDeferredResultInterceptors(DeferredResultProcessingInterceptor... interceptors)
Configure lifecycle interceptors with callbacks around concurrent request
execution that starts when a controller returns a
DeferredResult . |
AsyncSupportConfigurer |
setDefaultTimeout(long timeout)
Specify the amount of time, in milliseconds, before asynchronous request
handling times out.
|
AsyncSupportConfigurer |
setTaskExecutor(AsyncTaskExecutor taskExecutor)
Set the default
AsyncTaskExecutor to use when a controller method
returns a Callable . |
@Nullable private AsyncTaskExecutor taskExecutor
@Nullable private java.lang.Long timeout
private final java.util.List<CallableProcessingInterceptor> callableInterceptors
private final java.util.List<DeferredResultProcessingInterceptor> deferredResultInterceptors
public AsyncSupportConfigurer setTaskExecutor(AsyncTaskExecutor taskExecutor)
AsyncTaskExecutor
to use when a controller method
returns a Callable
. Controller methods can override this default on
a per-request basis by returning a WebAsyncTask
.
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.
As of 5.0 this executor is also used when a controller returns a reactive
type that does streaming (e.g. "text/event-stream" or
"application/stream+json") for the blocking writes to the
javax.servlet.ServletOutputStream
.
taskExecutor
- the task executor instance to use by defaultpublic AsyncSupportConfigurer setDefaultTimeout(long timeout)
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 millisecondspublic AsyncSupportConfigurer registerCallableInterceptors(CallableProcessingInterceptor... interceptors)
Callable
.interceptors
- the interceptors to registerpublic AsyncSupportConfigurer registerDeferredResultInterceptors(DeferredResultProcessingInterceptor... interceptors)
DeferredResult
.interceptors
- the interceptors to register@Nullable protected AsyncTaskExecutor getTaskExecutor()
@Nullable protected java.lang.Long getTimeout()
protected java.util.List<CallableProcessingInterceptor> getCallableInterceptors()
protected java.util.List<DeferredResultProcessingInterceptor> getDeferredResultInterceptors()