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 TypeMethodDescriptionvoid
addRequest
(com.castlabs.sdk.thumbs.ThumbnailRequest request) Adds aThumbnailRequest
to the queuevoid
clearAll()
Clear all queuesvoid
clearRequests
(boolean invokeCallbacks) Clears all pending requestsboolean
isEmpty()
com.castlabs.sdk.thumbs.ThumbnailLoad
pop()
Returns the nextThumbnailLoad
to load.void
replaceEntriesQueue
(Collection<com.castlabs.sdk.thumbs.ThumbnailEntryLoad> entriesToLoad) Clears the queue ofThumbnailEntryLoad
and 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 ofThumbnailEntryLoad
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 aThumbnailRequest
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 nextThumbnailLoad
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.
-