Interface TimeoutManager


  • public interface TimeoutManager

    This interface provides a callback for when the Request.setTimeout(long, TimeUnit) is invoked. If no such handler is registered at the time where the target RequestHandler is called, the default timeout manager will be injected.

    Author:
    Simon Thoresen Hult
    • Method Detail

      • scheduleTimeout

        void scheduleTimeout​(Request request)
        Schedule timeout management for a request. This is called by a request whenever Request.setTimeout(long, TimeUnit) is invoked; this may be called multiple times for the same Request.
        Parameters:
        request - the request whose timeout to schedule
      • unscheduleTimeout

        default void unscheduleTimeout​(Request request)
        Unschedule timeout management for a previously scheduled request. This is called whenever a request is cancelled, and the purpose is to free up resources taken by the implementation of this associated with the request.

        This is only called once for a request, and only after at least one scheduleTimeout call.

        The default implementation of this does nothing.

        Parameters:
        request - the previously scheduled timeout