Constructor and Description |
---|
WebAsyncTask(Callable<V> callable)
Create a
WebAsyncTask wrapping the given Callable . |
WebAsyncTask(Long timeout,
AsyncTaskExecutor executor,
Callable<V> callable)
Create a
WebAsyncTask with a timeout value, an executor instance, and a Callable. |
WebAsyncTask(long timeout,
Callable<V> callable)
Create a
WebAsyncTask with a timeout value and a Callable . |
WebAsyncTask(Long timeout,
String executorName,
Callable<V> callable)
Create a
WebAsyncTask with a timeout value, an executor name, and a Callable . |
Modifier and Type | Method and Description |
---|---|
Callable<?> |
getCallable()
Return the
Callable to use for concurrent handling, never null . |
AsyncTaskExecutor |
getExecutor()
Return the AsyncTaskExecutor to use for concurrent handling, or
null . |
Long |
getTimeout()
Return the timeout value in milliseconds or
null if not value is set. |
void |
onCompletion(Runnable callback)
Register code to invoke when the async request completes.
|
void |
onTimeout(Callable<V> callback)
Register code to invoke when the async request times out.
|
void |
setBeanFactory(BeanFactory beanFactory)
A
BeanFactory to use to resolve 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
- timeout value in millisecondscallable
- the callable for concurrent handlingpublic WebAsyncTask(Long timeout, String executorName, Callable<V> callable)
WebAsyncTask
with a timeout value, an executor name, and a Callable
.timeout
- timeout value in milliseconds; ignored if null
callable
- the callable for concurrent handlingpublic WebAsyncTask(Long timeout, AsyncTaskExecutor executor, Callable<V> callable)
WebAsyncTask
with a timeout value, an executor instance, and a Callable.timeout
- timeout value in milliseconds; ignored if null
callable
- the callable for concurrent handlingpublic Callable<?> getCallable()
Callable
to use for concurrent handling, never null
.public Long getTimeout()
null
if not value is set.public AsyncTaskExecutor getExecutor()
null
.public void setBeanFactory(BeanFactory beanFactory)
BeanFactory
to use to resolve an executor name. Applications are
not expected to have to set this property when WebAsyncTask
is used in a
Spring MVC controller.public void onTimeout(Callable<V> callback)
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)