static final class BoundedConcurrentHashMap.LRU<K,V> extends LinkedHashMap<BoundedConcurrentHashMap.HashEntry<K,V>,V> implements BoundedConcurrentHashMap.EvictionPolicy<K,V>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
private ConcurrentLinkedQueue<BoundedConcurrentHashMap.HashEntry<K,V>> |
accessQueue |
private float |
batchThresholdFactor |
private Set<BoundedConcurrentHashMap.HashEntry<K,V>> |
evicted |
private int |
maxBatchQueueSize |
private BoundedConcurrentHashMap.Segment<K,V> |
segment |
private static long |
serialVersionUID
The serialVersionUID
|
private int |
trimDownSize |
MAX_BATCH_SIZE| Constructor and Description |
|---|
LRU(BoundedConcurrentHashMap.Segment<K,V> s,
int capacity,
float lf,
int maxBatchSize,
float batchThresholdFactor) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Invoked to notify EvictionPolicy implementation that all Segment entries have been
cleared.
|
BoundedConcurrentHashMap.HashEntry<K,V> |
createNewEntry(K key,
int hash,
BoundedConcurrentHashMap.HashEntry<K,V> next,
V value) |
Set<BoundedConcurrentHashMap.HashEntry<K,V>> |
execute()
Invokes eviction policy algorithm and returns set of evicted entries.
|
protected boolean |
isAboveThreshold() |
boolean |
onEntryHit(BoundedConcurrentHashMap.HashEntry<K,V> e)
Invoked to notify EvictionPolicy implementation that an entry in Segment has been
accessed.
|
Set<BoundedConcurrentHashMap.HashEntry<K,V>> |
onEntryMiss(BoundedConcurrentHashMap.HashEntry<K,V> e)
Invoked to notify EvictionPolicy implementation that there has been an attempt to access
an entry in Segment, however that entry was not present in Segment.
|
void |
onEntryRemove(BoundedConcurrentHashMap.HashEntry<K,V> e)
Invoked to notify EvictionPolicy implementation that an entry e has been removed from
Segment.
|
protected boolean |
removeEldestEntry(Map.Entry<BoundedConcurrentHashMap.HashEntry<K,V>,V> eldest) |
BoundedConcurrentHashMap.Eviction |
strategy()
Returns type of eviction algorithm (strategy).
|
boolean |
thresholdExpired()
Returns true if batching threshold has expired, false otherwise.
|
containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeequals, hashCode, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeprivate static final long serialVersionUID
private final ConcurrentLinkedQueue<BoundedConcurrentHashMap.HashEntry<K,V>> accessQueue
private final BoundedConcurrentHashMap.Segment<K,V> segment
private final int maxBatchQueueSize
private final int trimDownSize
private final float batchThresholdFactor
private final Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted
public LRU(BoundedConcurrentHashMap.Segment<K,V> s, int capacity, float lf, int maxBatchSize, float batchThresholdFactor)
public Set<BoundedConcurrentHashMap.HashEntry<K,V>> execute()
BoundedConcurrentHashMap.EvictionPolicyexecute in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>public Set<BoundedConcurrentHashMap.HashEntry<K,V>> onEntryMiss(BoundedConcurrentHashMap.HashEntry<K,V> e)
BoundedConcurrentHashMap.EvictionPolicyonEntryMiss in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>e - accessed entry in Segmentpublic boolean onEntryHit(BoundedConcurrentHashMap.HashEntry<K,V> e)
BoundedConcurrentHashMap.EvictionPolicyonEntryHit in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>e - accessed entry in Segmentpublic boolean thresholdExpired()
BoundedConcurrentHashMap.EvictionPolicythresholdExpired in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>public void onEntryRemove(BoundedConcurrentHashMap.HashEntry<K,V> e)
BoundedConcurrentHashMap.EvictionPolicyonEntryRemove in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>e - removed entry in Segmentpublic void clear()
BoundedConcurrentHashMap.EvictionPolicyclear in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>clear in interface Map<BoundedConcurrentHashMap.HashEntry<K,V>,V>clear in class LinkedHashMap<BoundedConcurrentHashMap.HashEntry<K,V>,V>public BoundedConcurrentHashMap.Eviction strategy()
BoundedConcurrentHashMap.EvictionPolicystrategy in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>protected boolean isAboveThreshold()
protected boolean removeEldestEntry(Map.Entry<BoundedConcurrentHashMap.HashEntry<K,V>,V> eldest)
removeEldestEntry in class LinkedHashMap<BoundedConcurrentHashMap.HashEntry<K,V>,V>public BoundedConcurrentHashMap.HashEntry<K,V> createNewEntry(K key, int hash, BoundedConcurrentHashMap.HashEntry<K,V> next, V value)
createNewEntry in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>Copyright © 2021 JBoss by Red Hat. All rights reserved.