Top Description Fields Constructors Methods
org.springframework.web.servlet.config.annotation

public Class AsyncSupportConfigurer

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .List, java.util.concurrent.Callable, org.springframework.core.task.AsyncTaskExecutor, org.springframework.lang.Nullable, org.springframework.web.context.request.async.CallableProcessingInterceptor, .DeferredResult, .DeferredResultProcessingInterceptor

Helps with configuring options for asynchronous request processing.
Author
Rossen Stoyanchev
Since
3.2

Field Summary

Modifier and TypeField and Description
private final List<CallableProcessingInterceptor>
private final List<DeferredResultProcessingInterceptor>
private AsyncTaskExecutor
private Long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected List<CallableProcessingInterceptor>
protected List<DeferredResultProcessingInterceptor>
protected AsyncTaskExecutor
protected Long
public AsyncSupportConfigurer
registerCallableInterceptors(CallableProcessingInterceptor...
the interceptors to register
interceptors
)

Configure lifecycle interceptors with callbacks around concurrent request execution that starts when a controller returns a java.util.concurrent.Callable.

public AsyncSupportConfigurer
registerDeferredResultInterceptors(DeferredResultProcessingInterceptor...
the interceptors to register
interceptors
)

Configure lifecycle interceptors with callbacks around concurrent request execution that starts when a controller returns a DeferredResult.

public AsyncSupportConfigurer
setDefaultTimeout(long
the timeout value in milliseconds
timeout
)

Specify the amount of time, in milliseconds, before asynchronous request handling times out.

public AsyncSupportConfigurer
setTaskExecutor(AsyncTaskExecutor
the task executor instance to use by default
taskExecutor
)

The provided task executor is used for the following:

  1. Handle Callable controller method return values.
  2. Perform blocking writes when streaming to the response through a reactive (e.g. Reactor, RxJava) controller method return value.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

callableInterceptorsback to summary
private final List<CallableProcessingInterceptor> callableInterceptors
deferredResultInterceptorsback to summary
private final List<DeferredResultProcessingInterceptor> deferredResultInterceptors
taskExecutorback to summary
private AsyncTaskExecutor taskExecutor
Annotations
@Nullable
timeoutback to summary
private Long timeout
Annotations
@Nullable

Constructor Detail

AsyncSupportConfigurerback to summary
public AsyncSupportConfigurer()

Method Detail

getCallableInterceptorsback to summary
protected List<CallableProcessingInterceptor> getCallableInterceptors()
getDeferredResultInterceptorsback to summary
protected List<DeferredResultProcessingInterceptor> getDeferredResultInterceptors()
getTaskExecutorback to summary
protected AsyncTaskExecutor getTaskExecutor()
Annotations
@Nullable
getTimeoutback to summary
protected Long getTimeout()
Annotations
@Nullable
registerCallableInterceptorsback to summary
public AsyncSupportConfigurer registerCallableInterceptors(CallableProcessingInterceptor... interceptors)

Configure lifecycle interceptors with callbacks around concurrent request execution that starts when a controller returns a java.util.concurrent.Callable.

Parameters
interceptors:CallableProcessingInterceptor[]

the interceptors to register

registerDeferredResultInterceptorsback to summary
public AsyncSupportConfigurer registerDeferredResultInterceptors(DeferredResultProcessingInterceptor... interceptors)

Configure lifecycle interceptors with callbacks around concurrent request execution that starts when a controller returns a DeferredResult.

Parameters
interceptors:DeferredResultProcessingInterceptor[]

the interceptors to register

setDefaultTimeoutback to summary
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:long

the timeout value in milliseconds

setTaskExecutorback to summary
public AsyncSupportConfigurer setTaskExecutor(AsyncTaskExecutor taskExecutor)

The provided task executor is used for the following:

  1. Handle Callable controller method return values.
  2. Perform blocking writes when streaming to the response through a reactive (e.g. Reactor, RxJava) controller method return value.

If your application has controllers with such return types, please configure an AsyncTaskExecutor as the one used by default is not suitable for production under load.

Parameters
taskExecutor:AsyncTaskExecutor

the task executor instance to use by default