V - the value typepublic class WebAsyncTask<V> extends Object implements BeanFactoryAware
Callable, a timeout value, and a task executor.| Constructor and Description | 
|---|
| WebAsyncTask(Callable<V> callable)Create a  WebAsyncTaskwrapping the givenCallable. | 
| WebAsyncTask(Long timeout,
            AsyncTaskExecutor executor,
            Callable<V> callable)Create a  WebAsyncTaskwith a timeout value, an executor instance, and a Callable. | 
| WebAsyncTask(long timeout,
            Callable<V> callable)Create a  WebAsyncTaskwith a timeout value and aCallable. | 
| WebAsyncTask(Long timeout,
            String executorName,
            Callable<V> callable)Create a  WebAsyncTaskwith a timeout value, an executor name, and aCallable. | 
| Modifier and Type | Method and Description | 
|---|---|
| Callable<?> | getCallable()Return the  Callableto use for concurrent handling (nevernull). | 
| AsyncTaskExecutor | getExecutor()Return the AsyncTaskExecutor to use for concurrent handling,
 or  nullif none specified. | 
| Long | getTimeout()Return the timeout value in milliseconds, or  nullif no timeout is set. | 
| void | onCompletion(Runnable callback)Register code to invoke when the async request completes. | 
| void | onError(Callable<V> callback)Register code to invoke for an error during async request processing. | 
| void | onTimeout(Callable<V> callback)Register code to invoke when the async request times out. | 
| void | setBeanFactory(BeanFactory beanFactory)A  BeanFactoryto use for resolving an executor name. | 
public WebAsyncTask(Callable<V> callable)
WebAsyncTask wrapping the given Callable.callable - the callable for concurrent handlingpublic WebAsyncTask(long timeout,
                    Callable<V> callable)
WebAsyncTask with a timeout value and a Callable.timeout - a timeout value in millisecondscallable - the callable for concurrent handlingpublic WebAsyncTask(@Nullable Long timeout, String executorName, Callable<V> callable)
WebAsyncTask with a timeout value, an executor name, and a Callable.timeout - the timeout value in milliseconds; ignored if nullexecutorName - the name of an executor bean to usecallable - the callable for concurrent handlingpublic WebAsyncTask(@Nullable Long timeout, AsyncTaskExecutor executor, Callable<V> callable)
WebAsyncTask with a timeout value, an executor instance, and a Callable.timeout - the timeout value in milliseconds; ignored if nullexecutor - the executor to usecallable - the callable for concurrent handlingpublic Callable<?> getCallable()
Callable to use for concurrent handling (never null).@Nullable public Long getTimeout()
null if no timeout is set.public void setBeanFactory(BeanFactory beanFactory)
BeanFactory to use for resolving an executor name.
 This factory reference will automatically be set when
 WebAsyncTask is used within a Spring MVC controller.
setBeanFactory in interface BeanFactoryAwarebeanFactory - owning BeanFactory (never null).
 The bean can immediately call methods on the factory.BeanInitializationException@Nullable public AsyncTaskExecutor getExecutor()
null if none specified.public void onTimeout(Callable<V> callback)
This method is called from a container thread when an async request times
 out before the Callable has completed. The callback is executed in
 the same thread and therefore should return without blocking. It may return
 an alternative value to use, including an Exception or return
 RESULT_NONE.
public void onError(Callable<V> callback)
This method is called from a container thread when an error occurred
 while processing an async request before the Callable has
 completed. The callback is executed in the same thread and therefore
 should return without blocking. It may return an alternative value to
 use, including an Exception or return
 RESULT_NONE.
public void onCompletion(Runnable callback)
This method is called from a container thread when an async request completed for any reason, including timeout and network error.