* and dispose of any corresponding images.
*/
public final void run() {
while (true) {
// Get the next reference to dispose.
Reference reference = null;
// Block until a reference becomes available in the queue
try {
reference = referenceQueue.remove();
} catch (final InterruptedException e) {
// Reference will be null.
}
// Check to see if we've been told to stop.
if (reference == endMarker) {
// Clean up the image map
break;
}
// Image disposal - need to traverse the set of keys, since the
// image descriptor has been cleaned. No way to directly
// retrieve the equivalence set from the map . This could be
// improved (with better search/sort).
if (reference instanceof ImageCacheWeakReference) {
removeReferenceEnqueued((ImageCacheWeakReference) reference);
}
// Clear the reference.
if (reference != null) {
reference.clear();
}
}
}