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
Fields Modifier and Type Field Description private BoundedConcurrentHashMap.LIRSHashEntry<K,V>
nextInQueue
private BoundedConcurrentHashMap.LIRSHashEntry<K,V>
nextInStack
(package private) BoundedConcurrentHashMap.LIRS<K,V>
owner
private BoundedConcurrentHashMap.LIRSHashEntry<K,V>
previousInQueue
private BoundedConcurrentHashMap.LIRSHashEntry<K,V>
previousInStack
(package private) BoundedConcurrentHashMap.Recency
state
-
Fields inherited from class io.debezium.util.BoundedConcurrentHashMap.HashEntry
hash, key, next, value
-
-
Constructor Summary
Constructors Constructor Description LIRSHashEntry(BoundedConcurrentHashMap.LIRS<K,V> owner, K key, int hash, BoundedConcurrentHashMap.HashEntry<K,V> next, V value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private 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
equals(Object o)
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
isResident()
Returns true if this entry is resident in the cache, false otherwise.private void
migrateToQueue()
Moves this entry from the stack to the queue, marking it cold (as hot entries must remain in the stack).private void
migrateToStack()
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
moveToQueueEnd()
Moves this entry to the end of the queue.private void
moveToStackBottom()
Moves this entry to the bottom of the stack.private void
moveToStackTop()
Moves this entry to the top of the stack.private void
nonResident()
Marks this entry as non-resident.private V
remove()
Removes this entry from the cache.private void
removeFromQueue()
Removes this entry from the queue.private void
removeFromStack()
Removes this entry from the stack.private void
tempRemoveFromQueue()
Temporarily removes this entry from the queue, fixing up neighbor links.private void
tempRemoveFromStack()
Temporarily removes this entry from the stack, fixing up neighbor links.private void
warmupMiss()
Records a miss when the hot entry set is not full.-
Methods inherited from class io.debezium.util.BoundedConcurrentHashMap.HashEntry
newArray
-
-
-
-
Field Detail
-
previousInStack
private BoundedConcurrentHashMap.LIRSHashEntry<K,V> previousInStack
-
nextInStack
private BoundedConcurrentHashMap.LIRSHashEntry<K,V> nextInStack
-
previousInQueue
private BoundedConcurrentHashMap.LIRSHashEntry<K,V> previousInQueue
-
nextInQueue
private BoundedConcurrentHashMap.LIRSHashEntry<K,V> nextInQueue
-
state
volatile BoundedConcurrentHashMap.Recency state
-
owner
BoundedConcurrentHashMap.LIRS<K,V> owner
-
-
Constructor Detail
-
LIRSHashEntry
LIRSHashEntry(BoundedConcurrentHashMap.LIRS<K,V> owner, K key, int hash, BoundedConcurrentHashMap.HashEntry<K,V> next, V value)
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classBoundedConcurrentHashMap.HashEntry<K,V>
-
equals
public boolean equals(Object o)
- 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
public void hit(Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted)
Records a cache hit.
-
hotHit
private void hotHit(Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted)
Records a cache hit on a hot block.
-
coldHit
private void coldHit(Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted)
Records a cache hit on a cold block.
-
miss
private Set<BoundedConcurrentHashMap.HashEntry<K,V>> 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
private void fullMiss(Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted)
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
private void addToStackBefore(BoundedConcurrentHashMap.LIRSHashEntry<K,V> existingEntry)
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
private void addToQueueBefore(BoundedConcurrentHashMap.LIRSHashEntry<K,V> existingEntry)
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
private V remove()
Removes this entry from the cache. This operation is not specified in the paper, which does not account for forced eviction.
-
-