java.lang.Object
org.jpo.cache.ThumbnailCreationQueue
Queue that holds requests to create Thumbnails from Images.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final PriorityBlockingQueue<ThumbnailQueueRequest>
Implemented using a PriorityBlockingQueue -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clear()
Remove all queue requests from the queue.protected static ThumbnailQueueRequest
findThumbnailQueueRequest
(ThumbnailQueueRequestCallbackHandler callbackHandler) This method returns theThumbnailQueueRequest
for the supplied ThumbnailController if such a request exists.static void
removeFromQueue
(ThumbnailQueueRequest requestToRemove) removes the request for a specific ThumbnailController from the queue if it was on the queue in the first place.static ThumbnailQueueRequest
requestThumbnailCreation
(ThumbnailQueueRequest newThumbnailQueueRequest) This method creates aThumbnailQueueRequest
and sticks it on theThumbnailCreationQueue
if Thumbnail is not already on the queue.static int
size()
Returns the number of requests currently on the queue
-
Field Details
-
QUEUE
Implemented using a PriorityBlockingQueue
-
-
Method Details
-
requestThumbnailCreation
public static ThumbnailQueueRequest requestThumbnailCreation(ThumbnailQueueRequest newThumbnailQueueRequest) This method creates aThumbnailQueueRequest
and sticks it on theThumbnailCreationQueue
if Thumbnail is not already on the queue. Otherwise, the queue priority of the existing request is increased if the request comes in with a higher priority. If the new request forces a rebuild of the image this is also updated in the request.- Parameters:
newThumbnailQueueRequest
- the request to put on the queue- Returns:
- true if the request was added to the queue, false if the request already existed.
-
clear
@TestOnly public static void clear()Remove all queue requests from the queue. -
size
public static int size()Returns the number of requests currently on the queue- Returns:
- The number of requests on the queue.
-
removeFromQueue
removes the request for a specific ThumbnailController from the queue if it was on the queue in the first place.- Parameters:
requestToRemove
- The request to remove
-
findThumbnailQueueRequest
@TestOnly protected static ThumbnailQueueRequest findThumbnailQueueRequest(ThumbnailQueueRequestCallbackHandler callbackHandler) This method returns theThumbnailQueueRequest
for the supplied ThumbnailController if such a request exists. Otherwise, it returns null.- Parameters:
callbackHandler
- TheThumbnailQueueRequestCallbackHandler
for which the request is to be found- Returns:
- The ThumbnailQueueRequest if it exists.
-