Class Node<K,​V>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int PROBATION  
      static int PROTECTED  
      static int WINDOW  
    • Constructor Summary

      Constructors 
      Constructor Description
      Node()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean casVariableTime​(long expect, long update)
      Atomically sets the variable time to the given updated value if the current value equals the expected value and returns if the update was successful.
      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.
      abstract boolean containsValue​(@NonNull java.lang.Object value)
      Returns true if the given objects are considered equivalent.
      abstract void die()
      Sets the node to the dead state.
      long getAccessTime()
      Returns the time that this entry was last accessed, in ns.
      abstract @Nullable K getKey()
      Return the key or null if it has been reclaimed by the garbage collector.
      abstract @NonNull java.lang.Object getKeyReference()
      Returns the reference that the cache is holding the entry by.
      @Nullable Node<K,​V> getNextInAccessOrder()
      Retrieves the next element or null if either the element is unlinked or the last element on the deque.
      Node<K,​V> getNextInVariableOrder()  
      @Nullable Node<K,​V> getNextInWriteOrder()
      Retrieves the next element or null if either the element is unlinked or the last element on the deque.
      @org.checkerframework.checker.index.qual.NonNegative int getPolicyWeight()
      Returns the weight of this entry from the policy's perspective.
      @Nullable Node<K,​V> getPreviousInAccessOrder()
      Retrieves the previous element or null if either the element is unlinked or the first element on the deque.
      Node<K,​V> getPreviousInVariableOrder()  
      @Nullable Node<K,​V> getPreviousInWriteOrder()
      Retrieves the previous element or null if either the element is unlinked or the first element on the deque.
      int getQueueType()
      Returns the queue that the entry's resides in (window, probation, or protected).
      abstract @Nullable V getValue()
      Return the value or null if it has been reclaimed by the garbage collector.
      abstract @NonNull java.lang.Object getValueReference()
      Returns the reference to the value.
      long getVariableTime()
      Returns the variable expiration time, in nanoseconds.
      @org.checkerframework.checker.index.qual.NonNegative int getWeight()
      Returns the weight of this entry from the entry's perspective.
      long getWriteTime()
      Returns the time that this entry was last written, in ns.
      boolean inMainProbation()
      Returns if the entry is in the Main space's probation queue.
      boolean inMainProtected()
      Returns if the entry is in the Main space's protected queue.
      boolean inWindow()
      Returns if the entry is in the Window or Main space.
      abstract boolean isAlive()
      If the entry is available in the hash-table and page replacement policy.
      abstract boolean isDead()
      If the entry was removed from the hash-table and the page replacement policy.
      abstract boolean isRetired()
      If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.
      void makeMainProbation()
      Sets the status to the Main space's probation queue.
      void makeMainProtected()
      Sets the status to the Main space's protected queue.
      void makeWindow()
      Sets the status to the Window queue.
      abstract void retire()
      Sets the node to the retired state.
      void setAccessTime​(long time)
      Sets the access time in nanoseconds.
      void setNextInAccessOrder​(@Nullable Node<K,​V> next)
      Sets the next element or null if there is no link.
      void setNextInVariableOrder​(@Nullable Node<K,​V> prev)  
      void setNextInWriteOrder​(@Nullable Node<K,​V> next)
      Sets the next element or null if there is no link.
      void setPolicyWeight​(@org.checkerframework.checker.index.qual.NonNegative int weight)
      Sets the weight from the policy's perspective.
      void setPreviousInAccessOrder​(@Nullable Node<K,​V> prev)
      Sets the previous element or null if there is no link.
      void setPreviousInVariableOrder​(@Nullable Node<K,​V> prev)  
      void setPreviousInWriteOrder​(@Nullable Node<K,​V> prev)
      Sets the previous element or null if there is no link.
      void setQueueType​(int queueType)
      Set queue that the entry resides in (window, probation, or protected).
      abstract void setValue​(@NonNull V value, @Nullable java.lang.ref.ReferenceQueue<V> referenceQueue)
      Sets the value, which may be held strongly, weakly, or softly.
      void setVariableTime​(long time)
      Sets the variable expiration time in nanoseconds.
      void setWeight​(@org.checkerframework.checker.index.qual.NonNegative int weight)
      Sets the weight from the entry's perspective.
      void setWriteTime​(long time)
      Sets the write time in nanoseconds.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Node

        Node()
    • Method Detail

      • getKey

        public abstract @Nullable K getKey()
        Return the key or null if it has been reclaimed by the garbage collector.
      • getKeyReference

        public abstract @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 a WeakReference to that key.
      • getValue

        public abstract @Nullable V getValue()
        Return the value or null if it has been reclaimed by the garbage collector.
      • getValueReference

        public abstract @NonNull java.lang.Object getValueReference()
        Returns the reference to the value. This is either the value if strongly held or a Reference to that value.
      • setValue

        public abstract 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

        public abstract boolean containsValue​(@NonNull java.lang.Object value)
        Returns true 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

        public @org.checkerframework.checker.index.qual.NonNegative int getWeight()
        Returns the weight of this entry from the entry's perspective.
      • setWeight

        public void setWeight​(@org.checkerframework.checker.index.qual.NonNegative int weight)
        Sets the weight from the entry's perspective.
      • getPolicyWeight

        public @org.checkerframework.checker.index.qual.NonNegative int getPolicyWeight()
        Returns the weight of this entry from the policy's perspective.
      • setPolicyWeight

        public void setPolicyWeight​(@org.checkerframework.checker.index.qual.NonNegative int weight)
        Sets the weight from the policy's perspective.
      • isAlive

        public abstract boolean isAlive()
        If the entry is available in the hash-table and page replacement policy.
      • isRetired

        public abstract boolean isRetired()
        If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.
      • isDead

        public abstract boolean isDead()
        If the entry was removed from the hash-table and the page replacement policy.
      • retire

        public abstract void retire()
        Sets the node to the retired state.
      • die

        public abstract void die()
        Sets the node to the dead state.
      • getVariableTime

        public long getVariableTime()
        Returns the variable expiration time, in nanoseconds.
      • setVariableTime

        public void setVariableTime​(long time)
        Sets the variable expiration time in nanoseconds. This update may be set lazily and rely on the memory fence when the lock is released.
      • casVariableTime

        public boolean casVariableTime​(long expect,
                                       long update)
        Atomically sets the variable time to the given updated value if the current value equals the expected value and returns if the update was successful.
      • getPreviousInVariableOrder

        public Node<K,​V> getPreviousInVariableOrder()
      • setPreviousInVariableOrder

        public void setPreviousInVariableOrder​(@Nullable Node<K,​V> prev)
      • getNextInVariableOrder

        public Node<K,​V> getNextInVariableOrder()
      • setNextInVariableOrder

        public void setNextInVariableOrder​(@Nullable Node<K,​V> prev)
      • inWindow

        public boolean inWindow()
        Returns if the entry is in the Window or Main space.
      • inMainProbation

        public boolean inMainProbation()
        Returns if the entry is in the Main space's probation queue.
      • inMainProtected

        public boolean inMainProtected()
        Returns if the entry is in the Main space's protected queue.
      • makeWindow

        public void makeWindow()
        Sets the status to the Window queue.
      • makeMainProbation

        public void makeMainProbation()
        Sets the status to the Main space's probation queue.
      • makeMainProtected

        public void makeMainProtected()
        Sets the status to the Main space's protected queue.
      • getQueueType

        public int getQueueType()
        Returns the queue that the entry's resides in (window, probation, or protected).
      • setQueueType

        public void setQueueType​(int queueType)
        Set queue that the entry resides in (window, probation, or protected).
      • getAccessTime

        public long getAccessTime()
        Returns the time that this entry was last accessed, in ns.
      • setAccessTime

        public 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.
      • getWriteTime

        public long getWriteTime()
        Returns the time that this entry was last written, in ns.
      • setWriteTime

        public 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

        public 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.
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object