K - the type of keys maintained by this mapV - the type of mapped valuespublic abstract class AbstractQueueEvictionScheduler<K,V> extends Object implements EvictionScheduler<K,V>
EvictionScheduler which uses an EvictionQueue to
store EvictibleEntry instances in the order they should be evicted.
This class does not implement the actual eviction functionality, it should be
implemented by its subclasses.| Constructor and Description |
|---|
AbstractQueueEvictionScheduler()
Creates an eviction scheduler with a
NavigableMapEvictionQueue. |
AbstractQueueEvictionScheduler(EvictionQueue<K,V> queue)
Creates an eviction scheduler with the specified queue.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancelEviction(EvictibleEntry<K,V> e)
Cancels the eviction of the specified entry from its map.
|
protected void |
evictEntries()
Evicts all entries by calling the evictEntries method on the
queue.
|
protected long |
getNextEvictionTime()
Gets the time of the next scheduled eviction, in nanoseconds.
|
protected boolean |
hasScheduledEvictions()
Returns
true if there are any evictions scheduled. |
protected abstract void |
onCancelEviction(EvictibleEntry<K,V> e)
Actually cancels the eviction of the specified entry.
|
protected abstract void |
onEvictEntries()
Performs additional activities upon automated eviction of entries, if
needed.
|
protected abstract void |
onScheduleEviction(EvictibleEntry<K,V> e)
Actually schedules the eviction of the specified entry.
|
void |
scheduleEviction(EvictibleEntry<K,V> e)
Schedules the eviction of the specified entry from its map.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitshutdownpublic AbstractQueueEvictionScheduler()
NavigableMapEvictionQueue.public AbstractQueueEvictionScheduler(EvictionQueue<K,V> queue)
queue - the queue to be usedNullPointerExceptin - if the queue is nullpublic void scheduleEviction(EvictibleEntry<K,V> e)
ConcurrentMapWithTimedEvictionDecorator just after a new entry
has been added. The entry is not guaranteed to be evictible, it may also
be a permanent entry. Therefore, the implementation should check if this
entry is evictible before doing any scheduling.scheduleEviction in interface EvictionScheduler<K,V>e - the entry for which the eviction should be scheduled, if
evictible; it must have been already added to its mappublic void cancelEviction(EvictibleEntry<K,V> e)
ConcurrentMapWithTimedEvictionDecorator just after an entry has
been removed. The entry is not guaranteed to be evictible, it may also be
a permanent entry. Therefore, the implementation should check if this
entry is evictible before doing any cancellation.cancelEviction in interface EvictionScheduler<K,V>e - the entry for which the eviction should be cancelled, if
evictible; it must have been already removed from its mapprotected void evictEntries()
protected boolean hasScheduledEvictions()
true if there are any evictions scheduled. This
simply calls the hasEntries method on the queue.protected long getNextEvictionTime()
protected abstract void onScheduleEviction(EvictibleEntry<K,V> e)
e - the entry for which the eviction should be scheduledprotected abstract void onCancelEviction(EvictibleEntry<K,V> e)
e - the entry for which the eviction should be cancelledprotected abstract void onEvictEntries()
e - the entry for which the eviction should be scheduledCopyright © 2012–2016. All rights reserved.