Package 

Class RequestTracker


  • 
    public class RequestTracker
    
                        

    A class for tracking, canceling, and restarting in progress, completed, and failed requests.

    This class is not thread safe and must be accessed on the main thread.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean isPaused
    • Method Summary

      Modifier and Type Method Description
      boolean isPaused() Returns {@code true} if requests are currently paused, and {@code false} otherwise.
      void runRequest(@NonNull() Request request) Starts tracking the given request.
      boolean clearAndRemove(@Nullable() Request request) Stops tracking the given request, clears, and recycles it, and returns {@code true} if therequest was removed or invalid or {@code false} if the request was not found.
      void pauseRequests() Stops any in progress requests.
      void pauseAllRequests() Stops any in progress requests and releases bitmaps associated with completed requests.
      void resumeRequests() Starts any not yet completed or failed requests.
      void clearRequests() Cancels all requests and clears their resources.
      void restartRequests() Restarts failed requests and cancels and restarts in progress requests.
      String toString()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isPaused

         boolean isPaused()

        Returns {@code true} if requests are currently paused, and {@code false} otherwise.

      • clearAndRemove

         boolean clearAndRemove(@Nullable() Request request)

        Stops tracking the given request, clears, and recycles it, and returns {@code true} if therequest was removed or invalid or {@code false} if the request was not found.

      • pauseRequests

         void pauseRequests()

        Stops any in progress requests.

      • pauseAllRequests

         void pauseAllRequests()

        Stops any in progress requests and releases bitmaps associated with completed requests.

      • resumeRequests

         void resumeRequests()

        Starts any not yet completed or failed requests.

      • clearRequests

         void clearRequests()

        Cancels all requests and clears their resources.

        After this call requests cannot be restarted.

      • restartRequests

         void restartRequests()

        Restarts failed requests and cancels and restarts in progress requests.