org.springframework.web.context.request.async

## Class TimeoutCallableProcessingInterceptor

- java.lang.Object
- - org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter
  - - org.springframework.web.context.request.async.TimeoutCallableProcessingInterceptor

- All Implemented Interfaces:
    CallableProcessingInterceptor

      public class TimeoutCallableProcessingInterceptor
      extends CallableProcessingInterceptorAdapter

  Sends a 503 (SERVICE_UNAVAILABLE) in case of a timeout if the response is not already committed. Registered at the end, after all other interceptors and therefore invoked only if no other interceptor handles the timeout.

  Note that according to RFC 2616, a 503 without a 'Retry-After' header is interpreted as a 500 error and the client should not retry. Applications can install their own interceptor to handle a timeout and add a 'Retry-After' header if necessary.

  Since:
    3.2
  Author:
    Rossen Stoyanchev

- - ### Field Summary

    - ### Fields inherited from interface org.springframework.web.context.request.async.CallableProcessingInterceptor

      `RESPONSE_HANDLED, RESULT_NONE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimeoutCallableProcessingInterceptor()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> Object` | `handleTimeout(NativeWebRequest request, Callable<T> task)` This implementation always returns `RESULT_NONE`.

    - ### Methods inherited from class org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter

      `afterCompletion, beforeConcurrentHandling, postProcess, preProcess`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TimeoutCallableProcessingInterceptor

          public TimeoutCallableProcessingInterceptor()

  - ### Method Detail

    - #### handleTimeout

          public <T> Object handleTimeout(NativeWebRequest request,
                                 Callable<T> task)
                               throws Exception

      Description copied from class: `CallableProcessingInterceptorAdapter`
      This implementation always returns `RESULT_NONE`.
      Specified by:
        `handleTimeout` in interface `CallableProcessingInterceptor`
      Overrides:
        `handleTimeout` in class `CallableProcessingInterceptorAdapter`
      Parameters:
        `request` - the current request
        `task` - the task for the current async request
      Returns:
        a concurrent result value; if the value is anything other than `CallableProcessingInterceptor.RESULT_NONE` or `CallableProcessingInterceptor.RESPONSE_HANDLED`, concurrent processing is resumed and subsequent interceptors are not invoked
      Throws:
        `Exception` - in case of errors