Class ThumbnailLoadQueue


  • public class ThumbnailLoadQueue
    extends Object
    Holder of both ThumbnailRequest and ThumbnailEntryLoad queues. It's mandatory that all method calls which modify the queues to be synchronized externally.
    • Constructor Detail

      • ThumbnailLoadQueue

        public ThumbnailLoadQueue()
    • Method Detail

      • replaceEntriesQueue

        public void replaceEntriesQueue​(Collection<com.castlabs.sdk.thumbs.ThumbnailEntryLoad> entriesToLoad)
        Clears the queue of ThumbnailEntryLoad and replaces it with the given collection
        Parameters:
        entriesToLoad - the collection of entry loads to enqueue
      • addRequest

        public void addRequest​(com.castlabs.sdk.thumbs.ThumbnailRequest request)
        Adds a ThumbnailRequest to the queue
        Parameters:
        request - the request to add to the queue
      • clearRequests

        public void clearRequests​(boolean invokeCallbacks)
        Clears all pending requests
        Parameters:
        invokeCallbacks - whether to invoke the callbacks on the removed requests
      • clearAll

        public void clearAll()
        Clear all queues
      • isEmpty

        public boolean isEmpty()
        Returns:
        true if both of the underlying queues are empty
      • pop

        @Nullable
        public com.castlabs.sdk.thumbs.ThumbnailLoad pop()
        Returns the next ThumbnailLoad to load. This might be a Request or an Entry Load. If the request queue is not empty, it will be prioritized.
        Returns:
        the ThumbnailLoad to load next.