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 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.boolean
containsValue(java.lang.Object value)
Returnstrue
if the given objects are considered equivalent.void
die()
Sets the node to the dead state.default long
getAccessTime()
Returns the time that this entry was last accessed, in ns.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.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 int
getPolicyWeight()
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 int
getQueueType()
Returns the queue that the entry's resides in (eden, probation, or protected).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.default int
getWeight()
Returns the weight of this entry from the entry's perspective.default long
getWriteTime()
Returns the time that this entry was last written, in ns.default boolean
inEden()
Returns if the entry is in the Eden or Main space.default boolean
inMainProbation()
Returns if the entry is in the Main space's probation queue.default boolean
inMainProtected()
Returns if the entry is in the Main space's protected queue.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.default void
makeMainProbation()
Sets the status to the Main space's probation queue.default void
makeMainProtected()
Sets the status to the Main space's protected queue.void
retire()
Sets the node to the retired state.default void
setAccessTime(long time)
Sets the access time in nanoseconds.default void
setNextInAccessOrder(Node<K,V> next)
Sets the next element or null if there is no link.default void
setNextInWriteOrder(Node<K,V> next)
Sets the next element or null if there is no link.default void
setPolicyWeight(int weight)
Sets the weight from the policy's perspective.default void
setPreviousInAccessOrder(Node<K,V> prev)
Sets the previous element or null if there is no link.default void
setPreviousInWriteOrder(Node<K,V> prev)
Sets the previous element or null if there is no link.default void
setQueueType(int queueType)
Set queue that the entry resides in (eden, probation, or protected).void
setValue(V value, java.lang.ref.ReferenceQueue<V> referenceQueue)
Sets the value, which may be held strongly, weakly, or softly.default void
setWeight(int weight)
Sets the weight from the entry's perspective.default void
setWriteTime(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 ornull
if 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 aWeakReference
to that key.
-
getValue
@Nullable V getValue()
Return the value ornull
if 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 aReference
to 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)
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.
-
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.AccessOrder
Retrieves the previous element or null if either the element is unlinked or the first element on the deque.- Specified by:
getPreviousInAccessOrder
in interfaceAccessOrderDeque.AccessOrder<K>
-
setPreviousInAccessOrder
default void setPreviousInAccessOrder(@Nullable Node<K,V> prev)
Description copied from interface:AccessOrderDeque.AccessOrder
Sets the previous element or null if there is no link.- Specified by:
setPreviousInAccessOrder
in interfaceAccessOrderDeque.AccessOrder<K>
-
getNextInAccessOrder
default Node<K,V> getNextInAccessOrder()
Description copied from interface:AccessOrderDeque.AccessOrder
Retrieves the next element or null if either the element is unlinked or the last element on the deque.- Specified by:
getNextInAccessOrder
in interfaceAccessOrderDeque.AccessOrder<K>
-
setNextInAccessOrder
default void setNextInAccessOrder(@Nullable Node<K,V> next)
Description copied from interface:AccessOrderDeque.AccessOrder
Sets the next element or null if there is no link.- Specified by:
setNextInAccessOrder
in 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.WriteOrder
Retrieves the previous element or null if either the element is unlinked or the first element on the deque.- Specified by:
getPreviousInWriteOrder
in interfaceWriteOrderDeque.WriteOrder<K>
-
setPreviousInWriteOrder
default void setPreviousInWriteOrder(@Nullable Node<K,V> prev)
Description copied from interface:WriteOrderDeque.WriteOrder
Sets the previous element or null if there is no link.- Specified by:
setPreviousInWriteOrder
in interfaceWriteOrderDeque.WriteOrder<K>
-
getNextInWriteOrder
default Node<K,V> getNextInWriteOrder()
Description copied from interface:WriteOrderDeque.WriteOrder
Retrieves the next element or null if either the element is unlinked or the last element on the deque.- Specified by:
getNextInWriteOrder
in interfaceWriteOrderDeque.WriteOrder<K>
-
setNextInWriteOrder
default void setNextInWriteOrder(@Nullable Node<K,V> next)
Description copied from interface:WriteOrderDeque.WriteOrder
Sets the next element or null if there is no link.- Specified by:
setNextInWriteOrder
in interfaceWriteOrderDeque.WriteOrder<K>
-
-