Package io.debezium.util
Class BoundedConcurrentHashMap.LIRSHashEntry<K,V>
java.lang.Object
io.debezium.util.BoundedConcurrentHashMap.HashEntry<K,V>
io.debezium.util.BoundedConcurrentHashMap.LIRSHashEntry<K,V>
- Enclosing class:
- BoundedConcurrentHashMap<K,
V>
private static final class BoundedConcurrentHashMap.LIRSHashEntry<K,V>
extends BoundedConcurrentHashMap.HashEntry<K,V>
Adapted to Infinispan BoundedConcurrentHashMap using LIRS implementation ideas from Charles Fry (fry@google.com)
See http://code.google.com/p/concurrentlinkedhashmap/source/browse/trunk/src/test/java/com/googlecode/concurrentlinkedhashmap/caches/LirsMap.java
for original sources
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BoundedConcurrentHashMap.LIRSHashEntry<K,V> private BoundedConcurrentHashMap.LIRSHashEntry<K,V> (package private) BoundedConcurrentHashMap.LIRS<K,V> private BoundedConcurrentHashMap.LIRSHashEntry<K,V> private BoundedConcurrentHashMap.LIRSHashEntry<K,V> (package private) BoundedConcurrentHashMap.RecencyFields inherited from class io.debezium.util.BoundedConcurrentHashMap.HashEntry
hash, key, next, value -
Constructor Summary
ConstructorsConstructorDescriptionLIRSHashEntry(BoundedConcurrentHashMap.LIRS<K, V> owner, K key, int hash, BoundedConcurrentHashMap.HashEntry<K, V> next, V value) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddToQueueBefore(BoundedConcurrentHashMap.LIRSHashEntry<K, V> existingEntry) Inserts this entry before the specified existing entry in the queue.private voidaddToStackBefore(BoundedConcurrentHashMap.LIRSHashEntry<K, V> existingEntry) Inserts this entry before the specified existing entry in the stack.private voidcold()Marks this entry as cold.private voidcoldHit(Set<BoundedConcurrentHashMap.HashEntry<K, V>> evicted) Records a cache hit on a cold block.booleanprivate voidevict()Evicts this entry, removing it from the queue and setting its status to cold non-resident.private voidfullMiss(Set<BoundedConcurrentHashMap.HashEntry<K, V>> evicted) Records a miss when the hot entry set is full.inthashCode()voidhit(Set<BoundedConcurrentHashMap.HashEntry<K, V>> evicted) Records a cache hit.private voidhot()Marks this entry as hot.private voidhotHit(Set<BoundedConcurrentHashMap.HashEntry<K, V>> evicted) Records a cache hit on a hot block.booleaninQueue()Returns true if this entry is in the queue, false otherwise.booleaninStack()Returns true if this entry is in the stack, false otherwise.booleanReturns true if this entry is resident in the cache, false otherwise.private voidMoves this entry from the stack to the queue, marking it cold (as hot entries must remain in the stack).private voidMoves this entry from the queue to the stack, marking it hot (as cold resident entries must remain in the queue).private Set<BoundedConcurrentHashMap.HashEntry<K,V>> miss()Records a cache miss.private voidMoves this entry to the end of the queue.private voidMoves this entry to the bottom of the stack.private voidMoves this entry to the top of the stack.private voidMarks this entry as non-resident.private Vremove()Removes this entry from the cache.private voidRemoves this entry from the queue.private voidRemoves this entry from the stack.private voidTemporarily removes this entry from the queue, fixing up neighbor links.private voidTemporarily removes this entry from the stack, fixing up neighbor links.private voidRecords a miss when the hot entry set is not full.Methods inherited from class io.debezium.util.BoundedConcurrentHashMap.HashEntry
newArray
-
Field Details
-
previousInStack
-
nextInStack
-
previousInQueue
-
nextInQueue
-
state
-
owner
BoundedConcurrentHashMap.LIRS<K,V> owner
-
-
Constructor Details
-
LIRSHashEntry
LIRSHashEntry(BoundedConcurrentHashMap.LIRS<K, V> owner, K key, int hash, BoundedConcurrentHashMap.HashEntry<K, V> next, V value)
-
-
Method Details
-
hashCode
public int hashCode()- Overrides:
hashCodein classBoundedConcurrentHashMap.HashEntry<K,V>
-
equals
- Overrides:
equalsin classBoundedConcurrentHashMap.HashEntry<K,V>
-
inStack
public boolean inStack()Returns true if this entry is in the stack, false otherwise. -
inQueue
public boolean inQueue()Returns true if this entry is in the queue, false otherwise. -
hit
Records a cache hit. -
hotHit
Records a cache hit on a hot block. -
coldHit
Records a cache hit on a cold block. -
miss
Records a cache miss. This is how new entries join the LIRS stack and queue. This is called both when a new entry is first created, and when a non-resident entry is re-computed. -
warmupMiss
private void warmupMiss()Records a miss when the hot entry set is not full. -
fullMiss
Records a miss when the hot entry set is full. -
hot
private void hot()Marks this entry as hot. -
cold
private void cold()Marks this entry as cold. -
nonResident
private void nonResident()Marks this entry as non-resident. -
isResident
public boolean isResident()Returns true if this entry is resident in the cache, false otherwise. -
tempRemoveFromStack
private void tempRemoveFromStack()Temporarily removes this entry from the stack, fixing up neighbor links. This entry's links remain unchanged, meaning thatinStack()will continue to return true. This should only be called if this node's links will be subsequently changed. -
removeFromStack
private void removeFromStack()Removes this entry from the stack. -
addToStackBefore
Inserts this entry before the specified existing entry in the stack. -
moveToStackTop
private void moveToStackTop()Moves this entry to the top of the stack. -
moveToStackBottom
private void moveToStackBottom()Moves this entry to the bottom of the stack. -
tempRemoveFromQueue
private void tempRemoveFromQueue()Temporarily removes this entry from the queue, fixing up neighbor links. This entry's links remain unchanged. This should only be called if this node's links will be subsequently changed. -
removeFromQueue
private void removeFromQueue()Removes this entry from the queue. -
addToQueueBefore
Inserts this entry before the specified existing entry in the queue. -
moveToQueueEnd
private void moveToQueueEnd()Moves this entry to the end of the queue. -
migrateToQueue
private void migrateToQueue()Moves this entry from the stack to the queue, marking it cold (as hot entries must remain in the stack). This should only be called on resident entries, as non-resident entries should not be made resident. The bottom entry on the queue is always hot due to stack pruning. -
migrateToStack
private void migrateToStack()Moves this entry from the queue to the stack, marking it hot (as cold resident entries must remain in the queue). -
evict
private void evict()Evicts this entry, removing it from the queue and setting its status to cold non-resident. If the entry is already absent from the stack, it is removed from the backing map; otherwise it remains in order for its recency to be maintained. -
remove
Removes this entry from the cache. This operation is not specified in the paper, which does not account for forced eviction.
-