@Override protected boolean removeEldestEntry(Map.Entry<Job, TileBitmap> eldest) { if (size() > this.capacity) { TileBitmap bitmap = eldest.getValue(); if (bitmap != null) { bitmap.decrementRefCount(); } return true; } return false; }
@Override public void purge() { for (TileBitmap bitmap : this.lruCache.values()) { bitmap.decrementRefCount(); } this.lruCache.clear(); }
@Override public synchronized void put(Job key, TileBitmap bitmap) { if (key == null) { throw new IllegalArgumentException("key must not be null"); } else if (bitmap == null) { throw new IllegalArgumentException("bitmap must not be null"); } TileBitmap old = this.lruCache.get(key); if (old != null) { old.decrementRefCount(); } if (this.lruCache.put(key, bitmap) != null) { LOGGER.warning("overwriting cached entry: " + key); } bitmap.incrementRefCount(); this.observable.notifyObservers(); }
jobQueue.remove(rendererJob); if (bitmap != null) { bitmap.decrementRefCount();
@Override protected boolean removeEldestEntry(Map.Entry<Job, TileBitmap> eldest) { if (size() > this.capacity) { TileBitmap bitmap = eldest.getValue(); if (bitmap != null) { bitmap.decrementRefCount(); } return true; } return false; }
@Override public void purge() { for (TileBitmap bitmap : this.lruCache.values()) { bitmap.decrementRefCount(); } this.lruCache.clear(); }
@Override public synchronized void put(Job key, TileBitmap bitmap) { if (key == null) { throw new IllegalArgumentException("key must not be null"); } else if (bitmap == null) { throw new IllegalArgumentException("bitmap must not be null"); } TileBitmap old = this.lruCache.get(key); if (old != null) { old.decrementRefCount(); } if (this.lruCache.put(key, bitmap) != null) { LOGGER.warning("overwriting cached entry: " + key); } bitmap.incrementRefCount(); this.observable.notifyObservers(); }
jobQueue.remove(rendererJob); if (bitmap != null) { bitmap.decrementRefCount();