Class ConcurrentLinkedHashMap.Node
- java.lang.Object
-
- java.util.concurrent.atomic.AtomicReference<ConcurrentLinkedHashMap.WeightedValue<V>>
-
- com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.Node
-
- All Implemented Interfaces:
Linked<ConcurrentLinkedHashMap.Node>,java.io.Serializable
- Enclosing class:
- ConcurrentLinkedHashMap<K,V>
final class ConcurrentLinkedHashMap.Node extends java.util.concurrent.atomic.AtomicReference<ConcurrentLinkedHashMap.WeightedValue<V>> implements Linked<ConcurrentLinkedHashMap.Node>
A node contains the key, the weighted value, and the linkage pointers on the page-replacement algorithm's data structures.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Kkey(package private) ConcurrentLinkedHashMap.Nodenext(package private) ConcurrentLinkedHashMap.Nodeprev
-
Constructor Summary
Constructors Constructor Description Node(K key, ConcurrentLinkedHashMap.WeightedValue<V> weightedValue)Creates a new, unlinked node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConcurrentLinkedHashMap.NodegetNext()Retrieves the next element or null if either the element is unlinked or the last element on the deque.ConcurrentLinkedHashMap.NodegetPrevious()Retrieves the previous element or null if either the element is unlinked or the first element on the deque.(package private) VgetValue()Retrieves the value held by the current WeightedValue.(package private) voidmakeDead()Atomically transitions the node to the dead state and decrements the weightedSize.(package private) voidmakeRetired()Atomically transitions the node from the alive state to the retired state, if a valid transition.voidsetNext(ConcurrentLinkedHashMap.Node next)Sets the next element or null if there is no link.voidsetPrevious(ConcurrentLinkedHashMap.Node prev)Sets the previous element or null if there is no link.(package private) booleantryToRetire(ConcurrentLinkedHashMap.WeightedValue<V> expect)Attempts to transition the node from the alive state to the retired state.
-
-
-
Field Detail
-
key
final K key
-
prev
ConcurrentLinkedHashMap.Node prev
-
next
ConcurrentLinkedHashMap.Node next
-
-
Constructor Detail
-
Node
Node(K key, ConcurrentLinkedHashMap.WeightedValue<V> weightedValue)
Creates a new, unlinked node.
-
-
Method Detail
-
getPrevious
public ConcurrentLinkedHashMap.Node getPrevious()
Description copied from interface:LinkedRetrieves the previous element or null if either the element is unlinked or the first element on the deque.- Specified by:
getPreviousin interfaceLinked<ConcurrentLinkedHashMap.Node>
-
setPrevious
public void setPrevious(ConcurrentLinkedHashMap.Node prev)
Description copied from interface:LinkedSets the previous element or null if there is no link.- Specified by:
setPreviousin interfaceLinked<ConcurrentLinkedHashMap.Node>
-
getNext
public ConcurrentLinkedHashMap.Node getNext()
Description copied from interface:LinkedRetrieves the next element or null if either the element is unlinked or the last element on the deque.- Specified by:
getNextin interfaceLinked<ConcurrentLinkedHashMap.Node>
-
setNext
public void setNext(ConcurrentLinkedHashMap.Node next)
Description copied from interface:LinkedSets the next element or null if there is no link.- Specified by:
setNextin interfaceLinked<ConcurrentLinkedHashMap.Node>
-
getValue
V getValue()
Retrieves the value held by the current WeightedValue.
-
tryToRetire
boolean tryToRetire(ConcurrentLinkedHashMap.WeightedValue<V> expect)
Attempts to transition the node from the alive state to the retired state.- Parameters:
expect- the expected weighted value- Returns:
- if successful
-
makeRetired
void makeRetired()
Atomically transitions the node from the alive state to the retired state, if a valid transition.
-
makeDead
void makeDead()
Atomically transitions the node to the dead state and decrements the weightedSize.
-
-