Interface CallableProcessingInterceptor

All Known Implementing Classes:
TimeoutCallableProcessingInterceptor

public interface CallableProcessingInterceptor
Intercepts concurrent request handling, where the concurrent result is obtained by executing a 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/error 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 handleTimeout method can select a value to be used to resume processing.

Since:
3.2
Author:
Rossen Stoyanchev, Rob Winch
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Object
    Constant indicating that the response has been handled by this interceptor without a result and that no further interceptors are to be invoked.
    static final Object
    Constant indicating that no result has been determined by this interceptor, giving subsequent interceptors a chance.
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T> void
    Invoked from a container thread when async processing completes for any reason including timeout or network error.
    default <T> void
    Invoked before the start of concurrent handling in the original thread in which the Callable is submitted for concurrent handling.
    default <T> Object
    Invoked from a container thread when an error occurred while processing the async request before the Callable task completes.
    default <T> Object
    Invoked from a container thread when the async request times out before the Callable task completes.
    default <T> void
    postProcess(NativeWebRequest request, Callable<T> task, Object concurrentResult)
    Invoked after the Callable has produced a result in the async thread in which the Callable is executed.
    default <T> void
    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.