Class ConcurrentLinkedHashMap.Node
java.lang.Object
java.util.concurrent.atomic.AtomicReference<ConcurrentLinkedHashMap.WeightedValue<V>>
com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.Node
- All Implemented Interfaces:
Linked<ConcurrentLinkedHashMap<K,
,V>.Node> Serializable
- Enclosing class:
ConcurrentLinkedHashMap<K,
V>
final class ConcurrentLinkedHashMap.Node
extends AtomicReference<ConcurrentLinkedHashMap.WeightedValue<V>>
implements Linked<ConcurrentLinkedHashMap<K,V>.Node>
A node contains the key, the weighted value, and the linkage pointers on
the page-replacement algorithm's data structures.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNode
(K key, ConcurrentLinkedHashMap.WeightedValue<V> weightedValue) Creates a new, unlinked node. -
Method Summary
Modifier and TypeMethodDescriptiongetNext()
Retrieves the next element or null if either the element is unlinked or the last element on the deque.Retrieves the previous element or null if either the element is unlinked or the first element on the deque.(package private) V
getValue()
Retrieves the value held by the current WeightedValue.(package private) void
makeDead()
Atomically transitions the node to the dead state and decrements the weightedSize.(package private) void
Atomically transitions the node from the alive state to the retired state, if a valid transition.void
setNext
(ConcurrentLinkedHashMap<K, V>.Node next) Sets the next element or null if there is no link.void
setPrevious
(ConcurrentLinkedHashMap<K, V>.Node prev) Sets the previous element or null if there is no link.(package private) boolean
Attempts to transition the node from the alive state to the retired state.Methods inherited from class java.util.concurrent.atomic.AtomicReference
accumulateAndGet, compareAndSet, get, getAndAccumulate, getAndSet, getAndUpdate, lazySet, set, toString, updateAndGet, weakCompareAndSet
-
Field Details
-
key
-
prev
ConcurrentLinkedHashMap<K,V>.Node prev -
next
ConcurrentLinkedHashMap<K,V>.Node next
-
-
Constructor Details
-
Node
Node(K key, ConcurrentLinkedHashMap.WeightedValue<V> weightedValue) Creates a new, unlinked node.
-
-
Method Details
-
getPrevious
Description copied from interface:Linked
Retrieves the previous element or null if either the element is unlinked or the first element on the deque.- Specified by:
getPrevious
in interfaceLinked<ConcurrentLinkedHashMap<K,
V>.Node>
-
setPrevious
Description copied from interface:Linked
Sets the previous element or null if there is no link.- Specified by:
setPrevious
in interfaceLinked<ConcurrentLinkedHashMap<K,
V>.Node>
-
getNext
Description copied from interface:Linked
Retrieves the next element or null if either the element is unlinked or the last element on the deque. -
setNext
Description copied from interface:Linked
Sets the next element or null if there is no link. -
getValue
V getValue()Retrieves the value held by the current WeightedValue. -
tryToRetire
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.
-