Class ThumbnailLoadQueue

java.lang.Object
com.castlabs.sdk.thumbs.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 Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addRequest(com.castlabs.sdk.thumbs.ThumbnailRequest request)
    Adds a ThumbnailRequest to the queue
    void
    Clear all queues
    void
    clearRequests(boolean invokeCallbacks)
    Clears all pending requests
    boolean
     
    com.castlabs.sdk.thumbs.ThumbnailLoad
    pop()
    Returns the next ThumbnailLoad to load.
    void
    replaceEntriesQueue(Collection<com.castlabs.sdk.thumbs.ThumbnailEntryLoad> entriesToLoad)
    Clears the queue of ThumbnailEntryLoad and replaces it with the given collection

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ThumbnailLoadQueue

      public ThumbnailLoadQueue()
  • Method Details

    • 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.