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 ([email protected])
See http://code.google.com/p/concurrentlinkedhashmap/source/browse/trunk/src/test/java/com/googlecode/concurrentlinkedhashmap/caches/LirsMap.java
for original sources
-
Field Summary
Modifier 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.Recency
Fields inherited from class io.debezium.util.BoundedConcurrentHashMap.HashEntry
hash, key, next, value
-
Constructor Summary
ConstructorDescriptionLIRSHashEntry
(BoundedConcurrentHashMap.LIRS<K, V> owner, K key, int hash, BoundedConcurrentHashMap.HashEntry<K, V> next, V value) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addToQueueBefore
(BoundedConcurrentHashMap.LIRSHashEntry<K, V> existingEntry) Inserts this entry before the specified existing entry in the queue.private void
addToStackBefore
(BoundedConcurrentHashMap.LIRSHashEntry<K, V> existingEntry) Inserts this entry before the specified existing entry in the stack.private void
cold()
Marks this entry as cold.private void
coldHit
(Set<BoundedConcurrentHashMap.HashEntry<K, V>> evicted) Records a cache hit on a cold block.boolean
private void
evict()
Evicts this entry, removing it from the queue and setting its status to cold non-resident.private void
fullMiss
(Set<BoundedConcurrentHashMap.HashEntry<K, V>> evicted) Records a miss when the hot entry set is full.int
hashCode()
void
hit
(Set<BoundedConcurrentHashMap.HashEntry<K, V>> evicted) Records a cache hit.private void
hot()
Marks this entry as hot.private void
hotHit
(Set<BoundedConcurrentHashMap.HashEntry<K, V>> evicted) Records a cache hit on a hot block.boolean
inQueue()
Returns true if this entry is in the queue, false otherwise.boolean
inStack()
Returns true if this entry is in the stack, false otherwise.boolean
Returns true if this entry is resident in the cache, false otherwise.private void
Moves this entry from the stack to the queue, marking it cold (as hot entries must remain in the stack).private void
Moves 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 void
Moves this entry to the end of the queue.private void
Moves this entry to the bottom of the stack.private void
Moves this entry to the top of the stack.private void
Marks this entry as non-resident.private V
remove()
Removes this entry from the cache.private void
Removes this entry from the queue.private void
Removes this entry from the stack.private void
Temporarily removes this entry from the queue, fixing up neighbor links.private void
Temporarily removes this entry from the stack, fixing up neighbor links.private void
Records 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:
hashCode
in classBoundedConcurrentHashMap.HashEntry<K,
V>
-
equals
- Overrides:
equals
in 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.
-