Interface Node<K,V>
-
- All Superinterfaces:
AccessOrderDeque.AccessOrder<Node<K,V>>,WriteOrderDeque.WriteOrder<Node<K,V>>
- All Known Implementing Classes:
NodeFactory.SSo,NodeFactory.SSoA,NodeFactory.SSoAMS,NodeFactory.SSoAMW,NodeFactory.SSoAR,NodeFactory.SSoARMS,NodeFactory.SSoARMW,NodeFactory.SSoAW,NodeFactory.SSoAWMS,NodeFactory.SSoAWMW,NodeFactory.SSoAWR,NodeFactory.SSoAWRMS,NodeFactory.SSoAWRMW,NodeFactory.SSoMS,NodeFactory.SSoMW,NodeFactory.SSoR,NodeFactory.SSoRMS,NodeFactory.SSoRMW,NodeFactory.SSoW,NodeFactory.SSoWMS,NodeFactory.SSoWMW,NodeFactory.SSoWR,NodeFactory.SSoWRMS,NodeFactory.SSoWRMW,NodeFactory.SSt,NodeFactory.SStA,NodeFactory.SStAMS,NodeFactory.SStAMW,NodeFactory.SStAR,NodeFactory.SStARMS,NodeFactory.SStARMW,NodeFactory.SStAW,NodeFactory.SStAWMS,NodeFactory.SStAWMW,NodeFactory.SStAWR,NodeFactory.SStAWRMS,NodeFactory.SStAWRMW,NodeFactory.SStMS,NodeFactory.SStMW,NodeFactory.SStR,NodeFactory.SStRMS,NodeFactory.SStRMW,NodeFactory.SStW,NodeFactory.SStWMS,NodeFactory.SStWMW,NodeFactory.SStWR,NodeFactory.SStWRMS,NodeFactory.SStWRMW,NodeFactory.SW,NodeFactory.SWA,NodeFactory.SWAMS,NodeFactory.SWAMW,NodeFactory.SWAR,NodeFactory.SWARMS,NodeFactory.SWARMW,NodeFactory.SWAW,NodeFactory.SWAWMS,NodeFactory.SWAWMW,NodeFactory.SWAWR,NodeFactory.SWAWRMS,NodeFactory.SWAWRMW,NodeFactory.SWMS,NodeFactory.SWMW,NodeFactory.SWR,NodeFactory.SWRMS,NodeFactory.SWRMW,NodeFactory.SWW,NodeFactory.SWWMS,NodeFactory.SWWMW,NodeFactory.SWWR,NodeFactory.SWWRMS,NodeFactory.SWWRMW,NodeFactory.WSo,NodeFactory.WSoA,NodeFactory.WSoAMS,NodeFactory.WSoAMW,NodeFactory.WSoAR,NodeFactory.WSoARMS,NodeFactory.WSoARMW,NodeFactory.WSoAW,NodeFactory.WSoAWMS,NodeFactory.WSoAWMW,NodeFactory.WSoAWR,NodeFactory.WSoAWRMS,NodeFactory.WSoAWRMW,NodeFactory.WSoMS,NodeFactory.WSoMW,NodeFactory.WSoR,NodeFactory.WSoRMS,NodeFactory.WSoRMW,NodeFactory.WSoW,NodeFactory.WSoWMS,NodeFactory.WSoWMW,NodeFactory.WSoWR,NodeFactory.WSoWRMS,NodeFactory.WSoWRMW,NodeFactory.WSt,NodeFactory.WStA,NodeFactory.WStAMS,NodeFactory.WStAMW,NodeFactory.WStAR,NodeFactory.WStARMS,NodeFactory.WStARMW,NodeFactory.WStAW,NodeFactory.WStAWMS,NodeFactory.WStAWMW,NodeFactory.WStAWR,NodeFactory.WStAWRMS,NodeFactory.WStAWRMW,NodeFactory.WStMS,NodeFactory.WStMW,NodeFactory.WStR,NodeFactory.WStRMS,NodeFactory.WStRMW,NodeFactory.WStW,NodeFactory.WStWMS,NodeFactory.WStWMW,NodeFactory.WStWR,NodeFactory.WStWRMS,NodeFactory.WStWRMW,NodeFactory.WW,NodeFactory.WWA,NodeFactory.WWAMS,NodeFactory.WWAMW,NodeFactory.WWAR,NodeFactory.WWARMS,NodeFactory.WWARMW,NodeFactory.WWAW,NodeFactory.WWAWMS,NodeFactory.WWAWMW,NodeFactory.WWAWR,NodeFactory.WWAWRMS,NodeFactory.WWAWRMW,NodeFactory.WWMS,NodeFactory.WWMW,NodeFactory.WWR,NodeFactory.WWRMS,NodeFactory.WWRMW,NodeFactory.WWW,NodeFactory.WWWMS,NodeFactory.WWWMW,NodeFactory.WWWR,NodeFactory.WWWRMS,NodeFactory.WWWRMW
interface Node<K,V> extends AccessOrderDeque.AccessOrder<Node<K,V>>, WriteOrderDeque.WriteOrder<Node<K,V>>
An entry in the cache containing the key, value, weight, access, and write metadata. The key or value may be held weakly or softly requiring identity comparison.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleancasWriteTime(long expect, long update)Atomically sets the write time to the given updated value if the current value equals the expected value and returns if the update was successful.booleancontainsValue(java.lang.Object value)Returnstrueif the given objects are considered equivalent.voiddie()Sets the node to the dead state.default longgetAccessTime()Returns the time that this entry was last accessed, in ns.KgetKey()Return the key ornullif it has been reclaimed by the garbage collector.java.lang.ObjectgetKeyReference()Returns the reference that the cache is holding the entry by.default Node<K,V>getNextInAccessOrder()Retrieves the next element or null if either the element is unlinked or the last element on the deque.default Node<K,V>getNextInWriteOrder()Retrieves the next element or null if either the element is unlinked or the last element on the deque.default intgetPolicyWeight()Returns the weight of this entry from the policy's perspective.default Node<K,V>getPreviousInAccessOrder()Retrieves the previous element or null if either the element is unlinked or the first element on the deque.default Node<K,V>getPreviousInWriteOrder()Retrieves the previous element or null if either the element is unlinked or the first element on the deque.default intgetQueueType()Returns the queue that the entry's resides in (eden, probation, or protected).VgetValue()Return the value ornullif it has been reclaimed by the garbage collector.java.lang.ObjectgetValueReference()Returns the reference to the value.default intgetWeight()Returns the weight of this entry from the entry's perspective.default longgetWriteTime()Returns the time that this entry was last written, in ns.default booleaninEden()Returns if the entry is in the Eden or Main space.default booleaninMainProbation()Returns if the entry is in the Main space's probation queue.default booleaninMainProtected()Returns if the entry is in the Main space's protected queue.booleanisAlive()If the entry is available in the hash-table and page replacement policy.booleanisDead()If the entry was removed from the hash-table and the page replacement policy.booleanisRetired()If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.default voidmakeMainProbation()Sets the status to the Main space's probation queue.default voidmakeMainProtected()Sets the status to the Main space's protected queue.voidretire()Sets the node to the retired state.default voidsetAccessTime(long time)Sets the access time in nanoseconds.default voidsetNextInAccessOrder(Node<K,V> next)Sets the next element or null if there is no link.default voidsetNextInWriteOrder(Node<K,V> next)Sets the next element or null if there is no link.default voidsetPolicyWeight(int weight)Sets the weight from the policy's perspective.default voidsetPreviousInAccessOrder(Node<K,V> prev)Sets the previous element or null if there is no link.default voidsetPreviousInWriteOrder(Node<K,V> prev)Sets the previous element or null if there is no link.default voidsetQueueType(int queueType)Set queue that the entry resides in (eden, probation, or protected).voidsetValue(V value, java.lang.ref.ReferenceQueue<V> referenceQueue)Sets the value, which may be held strongly, weakly, or softly.default voidsetWeight(int weight)Sets the weight from the entry's perspective.default voidsetWriteTime(long time)Sets the write time in nanoseconds.
-
-
-
Field Detail
-
EDEN
static final int EDEN
- See Also:
- Constant Field Values
-
PROBATION
static final int PROBATION
- See Also:
- Constant Field Values
-
PROTECTED
static final int PROTECTED
- See Also:
- Constant Field Values
-
-
Method Detail
-
getKey
@Nullable K getKey()
Return the key ornullif it has been reclaimed by the garbage collector.
-
getKeyReference
@Nonnull java.lang.Object getKeyReference()
Returns the reference that the cache is holding the entry by. This is either the key if strongly held or aWeakReferenceto that key.
-
getValue
@Nullable V getValue()
Return the value ornullif it has been reclaimed by the garbage collector.
-
getValueReference
@Nonnull java.lang.Object getValueReference()
Returns the reference to the value. This is either the value if strongly held or aReferenceto that value.
-
setValue
void setValue(@Nonnull V value, @Nullable java.lang.ref.ReferenceQueue<V> referenceQueue)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
boolean containsValue(@Nonnull java.lang.Object value)Returnstrueif 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.
-
getWeight
@Nonnegative default int getWeight()
Returns the weight of this entry from the entry's perspective.
-
setWeight
@Nonnegative default void setWeight(int weight)
Sets the weight from the entry's perspective.
-
getPolicyWeight
@Nonnegative default int getPolicyWeight()
Returns the weight of this entry from the policy's perspective.
-
setPolicyWeight
@Nonnegative default void setPolicyWeight(int weight)
Sets the weight from the policy's perspective.
-
isAlive
boolean isAlive()
If the entry is available in the hash-table and page replacement policy.
-
isRetired
boolean isRetired()
If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.
-
isDead
boolean isDead()
If the entry was removed from the hash-table and the page replacement policy.
-
retire
void retire()
Sets the node to the retired state.
-
die
void die()
Sets the node to the dead state.
-
inEden
default boolean inEden()
Returns if the entry is in the Eden or Main space.
-
inMainProbation
default boolean inMainProbation()
Returns if the entry is in the Main space's probation queue.
-
inMainProtected
default boolean inMainProtected()
Returns if the entry is in the Main space's protected queue.
-
makeMainProbation
default void makeMainProbation()
Sets the status to the Main space's probation queue.
-
makeMainProtected
default void makeMainProtected()
Sets the status to the Main space's protected queue.
-
getQueueType
default int getQueueType()
Returns the queue that the entry's resides in (eden, probation, or protected).
-
setQueueType
default void setQueueType(int queueType)
Set queue that the entry resides in (eden, probation, or protected).
-
getAccessTime
default long getAccessTime()
Returns the time that this entry was last accessed, in ns.
-
setAccessTime
default void setAccessTime(long time)
Sets the access time in nanoseconds. This update may be set lazily and rely on the memory fence when the lock is released.
-
getPreviousInAccessOrder
default Node<K,V> getPreviousInAccessOrder()
Description copied from interface:AccessOrderDeque.AccessOrderRetrieves the previous element or null if either the element is unlinked or the first element on the deque.- Specified by:
getPreviousInAccessOrderin interfaceAccessOrderDeque.AccessOrder<K>
-
setPreviousInAccessOrder
default void setPreviousInAccessOrder(@Nullable Node<K,V> prev)Description copied from interface:AccessOrderDeque.AccessOrderSets the previous element or null if there is no link.- Specified by:
setPreviousInAccessOrderin interfaceAccessOrderDeque.AccessOrder<K>
-
getNextInAccessOrder
default Node<K,V> getNextInAccessOrder()
Description copied from interface:AccessOrderDeque.AccessOrderRetrieves the next element or null if either the element is unlinked or the last element on the deque.- Specified by:
getNextInAccessOrderin interfaceAccessOrderDeque.AccessOrder<K>
-
setNextInAccessOrder
default void setNextInAccessOrder(@Nullable Node<K,V> next)Description copied from interface:AccessOrderDeque.AccessOrderSets the next element or null if there is no link.- Specified by:
setNextInAccessOrderin interfaceAccessOrderDeque.AccessOrder<K>
-
getWriteTime
default long getWriteTime()
Returns the time that this entry was last written, in ns.
-
setWriteTime
default void setWriteTime(long time)
Sets the write time in nanoseconds. This update may be set lazily and rely on the memory fence when the lock is released.
-
casWriteTime
default boolean casWriteTime(long expect, long update)Atomically sets the write time to the given updated value if the current value equals the expected value and returns if the update was successful.
-
getPreviousInWriteOrder
default Node<K,V> getPreviousInWriteOrder()
Description copied from interface:WriteOrderDeque.WriteOrderRetrieves the previous element or null if either the element is unlinked or the first element on the deque.- Specified by:
getPreviousInWriteOrderin interfaceWriteOrderDeque.WriteOrder<K>
-
setPreviousInWriteOrder
default void setPreviousInWriteOrder(@Nullable Node<K,V> prev)Description copied from interface:WriteOrderDeque.WriteOrderSets the previous element or null if there is no link.- Specified by:
setPreviousInWriteOrderin interfaceWriteOrderDeque.WriteOrder<K>
-
getNextInWriteOrder
default Node<K,V> getNextInWriteOrder()
Description copied from interface:WriteOrderDeque.WriteOrderRetrieves the next element or null if either the element is unlinked or the last element on the deque.- Specified by:
getNextInWriteOrderin interfaceWriteOrderDeque.WriteOrder<K>
-
setNextInWriteOrder
default void setNextInWriteOrder(@Nullable Node<K,V> next)Description copied from interface:WriteOrderDeque.WriteOrderSets the next element or null if there is no link.- Specified by:
setNextInWriteOrderin interfaceWriteOrderDeque.WriteOrder<K>
-
-