Class RequestTracker


  • public class RequestTracker
    extends java.lang.Object
    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.

    • Constructor Summary

      Constructors 
      Constructor Description
      RequestTracker()  
    • Method Summary

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

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RequestTracker

        public RequestTracker()
    • Method Detail

      • runRequest

        public void runRequest​(@NonNull
                               Request request)
        Starts tracking the given request.
      • clearAndRemove

        public boolean clearAndRemove​(@Nullable
                                      Request request)
        Stops tracking the given request, clears, and recycles it, and returns true if the request was removed or invalid or false if the request was not found.
      • isPaused

        public boolean isPaused()
        Returns true if requests are currently paused, and false otherwise.
      • pauseRequests

        public void pauseRequests()
        Stops any in progress requests.
      • pauseAllRequests

        public void pauseAllRequests()
        Stops any in progress requests and releases bitmaps associated with completed requests.
      • resumeRequests

        public void resumeRequests()
        Starts any not yet completed or failed requests.
      • clearRequests

        public void clearRequests()
        Cancels all requests and clears their resources.

        After this call requests cannot be restarted.

      • restartRequests

        public void restartRequests()
        Restarts failed requests and cancels and restarts in progress requests.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object