@Deprecated public abstract class CallableProcessingInterceptorAdapter extends Object implements CallableProcessingInterceptor
CallableProcessingInterceptor
interface,
for simplified implementation of individual methods.RESPONSE_HANDLED, RESULT_NONE
Constructor and Description |
---|
CallableProcessingInterceptorAdapter()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
<T> void |
afterCompletion(NativeWebRequest request,
Callable<T> task)
Deprecated.
Invoked from a container thread when async processing completes for any
reason including timeout or network error.
|
<T> void |
beforeConcurrentHandling(NativeWebRequest request,
Callable<T> task)
Deprecated.
Invoked before the start of concurrent handling in the original
thread in which the
Callable is submitted for concurrent handling. |
<T> Object |
handleError(NativeWebRequest request,
Callable<T> task,
Throwable t)
Deprecated.
Invoked from a container thread when an error occurred while processing
the async request before the
Callable task completes. |
<T> Object |
handleTimeout(NativeWebRequest request,
Callable<T> task)
Deprecated.
Invoked from a container thread when the async request times out before
the
Callable task completes. |
<T> void |
postProcess(NativeWebRequest request,
Callable<T> task,
Object concurrentResult)
Deprecated.
Invoked after the
Callable has produced a result in the
async thread in which the Callable is executed. |
<T> void |
preProcess(NativeWebRequest request,
Callable<T> task)
Deprecated.
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 . |
public CallableProcessingInterceptorAdapter()
public <T> void beforeConcurrentHandling(NativeWebRequest request, Callable<T> task) throws Exception
CallableProcessingInterceptor
Callable
is submitted for concurrent handling.
This is useful for capturing the state of the current thread just prior to
invoking the Callable
. Once the state is captured, it can then be
transferred to the new Thread
in
CallableProcessingInterceptor.preProcess(NativeWebRequest, Callable)
. Capturing the state of
Spring Security's SecurityContextHolder and migrating it to the new Thread
is a concrete example of where this is useful.
The default implementation is empty.
beforeConcurrentHandling
in interface CallableProcessingInterceptor
request
- the current requesttask
- the task for the current async requestException
- in case of errorspublic <T> void preProcess(NativeWebRequest request, Callable<T> task) throws Exception
CallableProcessingInterceptor
Callable
is executed and before the
actual invocation of the Callable
.
The default implementation is empty.
preProcess
in interface CallableProcessingInterceptor
request
- the current requesttask
- the task for the current async requestException
- in case of errorspublic <T> void postProcess(NativeWebRequest request, Callable<T> task, Object concurrentResult) throws Exception
CallableProcessingInterceptor
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.
The default implementation is empty.
postProcess
in interface CallableProcessingInterceptor
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 exceptionException
- in case of errorspublic <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) throws Exception
CallableProcessingInterceptor
Callable
task completes. Implementations may return a value,
including an Exception
, to use instead of the value the
Callable
did not return in time.
The default implementation always returns CallableProcessingInterceptor.RESULT_NONE
.
handleTimeout
in interface CallableProcessingInterceptor
request
- the current requesttask
- the task for the current async requestCallableProcessingInterceptor.RESULT_NONE
or CallableProcessingInterceptor.RESPONSE_HANDLED
, concurrent processing
is resumed and subsequent interceptors are not invokedException
- in case of errorspublic <T> Object handleError(NativeWebRequest request, Callable<T> task, Throwable t) throws Exception
CallableProcessingInterceptor
Callable
task completes.
Implementations may return a value, including an Exception
, to
use instead of the value the Callable
did not return in time.
The default implementation always returns CallableProcessingInterceptor.RESULT_NONE
.
handleError
in interface CallableProcessingInterceptor
request
- the current requesttask
- the task for the current async requestt
- the error that occurred while request processingCallableProcessingInterceptor.RESULT_NONE
or CallableProcessingInterceptor.RESPONSE_HANDLED
, concurrent processing
is resumed and subsequent interceptors are not invokedException
- in case of errorspublic <T> void afterCompletion(NativeWebRequest request, Callable<T> task) throws Exception
CallableProcessingInterceptor
The default implementation is empty.
afterCompletion
in interface CallableProcessingInterceptor
request
- the current requesttask
- the task for the current async requestException
- in case of errors