Package com.castlabs.sdk.thumbs
Class ThumbnailLoadQueue
java.lang.Object
com.castlabs.sdk.thumbs.ThumbnailLoadQueue
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRequest(com.castlabs.sdk.thumbs.ThumbnailRequest request) Adds aThumbnailRequestto the queuevoidclearAll()Clear all queuesvoidclearRequests(boolean invokeCallbacks) Clears all pending requestsbooleanisEmpty()com.castlabs.sdk.thumbs.ThumbnailLoadpop()Returns the nextThumbnailLoadto load.voidreplaceEntriesQueue(Collection<com.castlabs.sdk.thumbs.ThumbnailEntryLoad> entriesToLoad) Clears the queue ofThumbnailEntryLoadand replaces it with the given collection
-
Constructor Details
-
ThumbnailLoadQueue
public ThumbnailLoadQueue()
-
-
Method Details
-
replaceEntriesQueue
public void replaceEntriesQueue(Collection<com.castlabs.sdk.thumbs.ThumbnailEntryLoad> entriesToLoad) Clears the queue ofThumbnailEntryLoadand 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 aThumbnailRequestto 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 nextThumbnailLoadto load. This might be a Request or an Entry Load. If the request queue is not empty, it will be prioritized.- Returns:
- the
ThumbnailLoadto load next.
-