public interface CallableProcessingInterceptor
Callable
on behalf of the application with
an AsyncTaskExecutor
.
A CallableProcessingInterceptor
is invoked before and after the
invocation of the Callable
task in the asynchronous thread, as well
as on timeout from a container thread, or after completing for any reason
including a timeout or network error.
As a general rule exceptions raised by interceptor methods will cause
async processing to resume by dispatching back to the container and using
the Exception instance as the concurrent result. Such exceptions will then
be processed through the HandlerExceptionResolver
mechanism.
The afterTimeout
method
can select a value to be used to resume processing.
Modifier and Type | Field and Description |
---|---|
static java.lang.Object |
RESULT_NONE |
Modifier and Type | Method and Description |
---|---|
<T> void |
afterCompletion(NativeWebRequest request,
java.util.concurrent.Callable<T> task)
Invoked from a container thread when async processing completes for any
reason including timeout or network error.
|
<T> java.lang.Object |
afterTimeout(NativeWebRequest request,
java.util.concurrent.Callable<T> task)
Invoked from a container thread when the async request times out before
the
Callable task completes. |
<T> void |
postProcess(NativeWebRequest request,
java.util.concurrent.Callable<T> task,
java.lang.Object concurrentResult)
Invoked after the
Callable has produced a result in the
async thread in which the Callable is executed. |
<T> void |
preProcess(NativeWebRequest request,
java.util.concurrent.Callable<T> task)
Invoked after the start of concurrent handling in the async
thread in which the
Callable is executed and before the
actual invocation of the Callable . |
<T> void preProcess(NativeWebRequest request, java.util.concurrent.Callable<T> task) throws java.lang.Exception
Callable
is executed and before the
actual invocation of the Callable
.request
- the current requesttask
- the task for the current async requestjava.lang.Exception
- in case of errors<T> void postProcess(NativeWebRequest request, java.util.concurrent.Callable<T> task, java.lang.Object concurrentResult) throws java.lang.Exception
Callable
has produced a result in the
async thread in which the Callable
is executed. This method may
be invoked later than afterTimeout
or afterCompletion
depending on when the Callable
finishes processing.request
- the current requesttask
- the task for the current async requestconcurrentResult
- the result of concurrent processing, which could
be a Throwable
if the Callable
raised an exceptionjava.lang.Exception
- in case of errors<T> java.lang.Object afterTimeout(NativeWebRequest request, java.util.concurrent.Callable<T> task) throws java.lang.Exception
Callable
task completes. Implementations may return a value,
including an Exception
, to use instead of the value the
Callable
did not return in time.request
- the current requesttask
- the task for the current async requestRESULT_NONE
, concurrent processing is resumed and subsequent
interceptors are not invokedjava.lang.Exception
- in case of errors<T> void afterCompletion(NativeWebRequest request, java.util.concurrent.Callable<T> task) throws java.lang.Exception
request
- the current requesttask
- the task for the current async requestjava.lang.Exception
- in case of errors