Class WebAsyncTask<V>
- Type Parameters:
- V- the value type
- All Implemented Interfaces:
- Aware,- BeanFactoryAware
Callable, a timeout value, and a task executor.- Since:
- 3.2
- Author:
- Rossen Stoyanchev, Juergen Hoeller
- 
Constructor SummaryConstructorsConstructorDescriptionWebAsyncTask(long timeout, Callable<V> callable) Create aWebAsyncTaskwith a timeout value and aCallable.WebAsyncTask(Long timeout, String executorName, Callable<V> callable) Create aWebAsyncTaskwith a timeout value, an executor name, and aCallable.WebAsyncTask(Long timeout, AsyncTaskExecutor executor, Callable<V> callable) Create aWebAsyncTaskwith a timeout value, an executor instance, and a Callable.WebAsyncTask(Callable<V> callable) Create aWebAsyncTaskwrapping the givenCallable.
- 
Method SummaryModifier and TypeMethodDescriptionCallable<?>Return theCallableto use for concurrent handling (nevernull).Return the AsyncTaskExecutor to use for concurrent handling, ornullif none specified.Return the timeout value in milliseconds, ornullif no timeout is set.voidonCompletion(Runnable callback) Register code to invoke when the async request completes.voidRegister code to invoke for an error during async request processing.voidRegister code to invoke when the async request times out.voidsetBeanFactory(BeanFactory beanFactory) ABeanFactoryto use for resolving an executor name.
- 
Constructor Details- 
WebAsyncTaskCreate aWebAsyncTaskwrapping the givenCallable.- Parameters:
- callable- the callable for concurrent handling
 
- 
WebAsyncTaskCreate aWebAsyncTaskwith a timeout value and aCallable.- Parameters:
- timeout- a timeout value in milliseconds
- callable- the callable for concurrent handling
 
- 
WebAsyncTaskCreate aWebAsyncTaskwith a timeout value, an executor name, and aCallable.- Parameters:
- timeout- the timeout value in milliseconds; ignored if- null
- executorName- the name of an executor bean to use
- callable- the callable for concurrent handling
 
- 
WebAsyncTaskCreate aWebAsyncTaskwith a timeout value, an executor instance, and a Callable.- Parameters:
- timeout- the timeout value in milliseconds; ignored if- null
- executor- the executor to use
- callable- the callable for concurrent handling
 
 
- 
- 
Method Details- 
getCallableReturn theCallableto use for concurrent handling (nevernull).
- 
getTimeoutReturn the timeout value in milliseconds, ornullif no timeout is set.
- 
setBeanFactoryABeanFactoryto use for resolving an executor name.This factory reference will automatically be set when WebAsyncTaskis used within a Spring MVC controller.- Specified by:
- setBeanFactoryin interface- BeanFactoryAware
- Parameters:
- beanFactory- owning BeanFactory (never- null). The bean can immediately call methods on the factory.
- See Also:
 
- 
getExecutorReturn the AsyncTaskExecutor to use for concurrent handling, ornullif none specified.
- 
onTimeoutRegister code to invoke when the async request times out.This method is called from a container thread when an async request times out before the Callablehas completed. The callback is executed in the same thread and therefore should return without blocking. It may return an alternative value to use, including anExceptionor returnRESULT_NONE.
- 
onErrorRegister code to invoke for an error during async request processing.This method is called from a container thread when an error occurred while processing an async request before the Callablehas completed. The callback is executed in the same thread and therefore should return without blocking. It may return an alternative value to use, including anExceptionor returnRESULT_NONE.- Since:
- 5.0
 
- 
onCompletionRegister code to invoke when the async request completes.This method is called from a container thread when an async request completed for any reason, including timeout and network error. 
 
-