Class NodeFactory.WW<K,V>
- java.lang.Object
-
- com.github.benmanes.caffeine.cache.NodeFactory.WW<K,V>
-
- All Implemented Interfaces:
AccessOrderDeque.AccessOrder<Node<K,V>>
,Node<K,V>
,WriteOrderDeque.WriteOrder<Node<K,V>>
- Direct Known Subclasses:
NodeFactory.WWA
,NodeFactory.WWMS
,NodeFactory.WWMW
,NodeFactory.WWR
,NodeFactory.WWW
- Enclosing class:
- NodeFactory
static class NodeFactory.WW<K,V> extends java.lang.Object implements Node<K,V>
-
-
Field Summary
Fields Modifier and Type Field Description private References.WeakKeyReference<K>
key
protected static long
KEY_OFFSET
private References.WeakValueReference<V>
value
protected static long
VALUE_OFFSET
-
Constructor Summary
Constructors Constructor Description WW(java.lang.Object keyReference, V value, java.lang.ref.ReferenceQueue<V> valueReferenceQueue, int weight, long now)
WW(K key, java.lang.ref.ReferenceQueue<K> keyReferenceQueue, V value, java.lang.ref.ReferenceQueue<V> valueReferenceQueue, int weight, long now)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsValue(java.lang.Object value)
Returnstrue
if the given objects are considered equivalent.void
die()
Sets the node to the dead state.K
getKey()
Return the key ornull
if it has been reclaimed by the garbage collector.java.lang.Object
getKeyReference()
Returns the reference that the cache is holding the entry by.V
getValue()
Return the value ornull
if it has been reclaimed by the garbage collector.java.lang.Object
getValueReference()
Returns the reference to the value.boolean
isAlive()
If the entry is available in the hash-table and page replacement policy.boolean
isDead()
If the entry was removed from the hash-table and the page replacement policy.boolean
isRetired()
If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.void
retire()
Sets the node to the retired state.void
setValue(V value, java.lang.ref.ReferenceQueue<V> referenceQueue)
Sets the value, which may be held strongly, weakly, or softly.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.benmanes.caffeine.cache.Node
casWriteTime, getAccessTime, getNextInAccessOrder, getNextInWriteOrder, getPolicyWeight, getPreviousInAccessOrder, getPreviousInWriteOrder, getQueueType, getWeight, getWriteTime, inEden, inMainProbation, inMainProtected, makeMainProbation, makeMainProtected, setAccessTime, setNextInAccessOrder, setNextInWriteOrder, setPolicyWeight, setPreviousInAccessOrder, setPreviousInWriteOrder, setQueueType, setWeight, setWriteTime
-
-
-
-
Field Detail
-
KEY_OFFSET
protected static final long KEY_OFFSET
-
VALUE_OFFSET
protected static final long VALUE_OFFSET
-
key
private volatile References.WeakKeyReference<K> key
-
value
private volatile References.WeakValueReference<V> value
-
-
Method Detail
-
getKey
public final K getKey()
Description copied from interface:Node
Return the key ornull
if it has been reclaimed by the garbage collector.
-
getKeyReference
public final java.lang.Object getKeyReference()
Description copied from interface:Node
Returns the reference that the cache is holding the entry by. This is either the key if strongly held or aWeakReference
to that key.- Specified by:
getKeyReference
in interfaceNode<K,V>
-
getValue
public final V getValue()
Description copied from interface:Node
Return the value ornull
if it has been reclaimed by the garbage collector.
-
getValueReference
public final java.lang.Object getValueReference()
Description copied from interface:Node
Returns the reference to the value. This is either the value if strongly held or aReference
to that value.- Specified by:
getValueReference
in interfaceNode<K,V>
-
setValue
public final void setValue(V value, java.lang.ref.ReferenceQueue<V> referenceQueue)
Description copied from interface:Node
Sets the value, which may be held strongly, weakly, or softly. This update may be set lazily and rely on the memory fence when the lock is released.
-
containsValue
public final boolean containsValue(java.lang.Object value)
Description copied from interface:Node
Returnstrue
if the given objects are considered equivalent. A strongly held value is compared by equality and a weakly or softly held value is compared by identity.- Specified by:
containsValue
in interfaceNode<K,V>
-
isAlive
public final boolean isAlive()
Description copied from interface:Node
If the entry is available in the hash-table and page replacement policy.
-
isRetired
public final boolean isRetired()
Description copied from interface:Node
If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.
-
retire
public final void retire()
Description copied from interface:Node
Sets the node to the retired state.
-
isDead
public final boolean isDead()
Description copied from interface:Node
If the entry was removed from the hash-table and the page replacement policy.
-
die
public final void die()
Description copied from interface:Node
Sets the node to the dead state.
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-