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) K
key
(package private) ConcurrentLinkedHashMap.Node
next
(package private) ConcurrentLinkedHashMap.Node
prev
-
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.Node
getNext()
Retrieves the next element or null if either the element is unlinked or the last element on the deque.ConcurrentLinkedHashMap.Node
getPrevious()
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
makeRetired()
Atomically transitions the node from the alive state to the retired state, if a valid transition.void
setNext(ConcurrentLinkedHashMap.Node next)
Sets the next element or null if there is no link.void
setPrevious(ConcurrentLinkedHashMap.Node prev)
Sets the previous element or null if there is no link.(package private) boolean
tryToRetire(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: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.Node>
-
setPrevious
public void setPrevious(ConcurrentLinkedHashMap.Node prev)
Description copied from interface:Linked
Sets the previous element or null if there is no link.- Specified by:
setPrevious
in interfaceLinked<ConcurrentLinkedHashMap.Node>
-
getNext
public ConcurrentLinkedHashMap.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.- Specified by:
getNext
in interfaceLinked<ConcurrentLinkedHashMap.Node>
-
setNext
public void setNext(ConcurrentLinkedHashMap.Node next)
Description copied from interface:Linked
Sets the next element or null if there is no link.- Specified by:
setNext
in 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.
-
-