com.thimbleware.jmemcached.storage.hash
Class ConcurrentLinkedHashMap.Node<K,V>

java.lang.Object
  extended by com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap.Node<K,V>
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
ConcurrentLinkedHashMap<K,V extends SizedItem>

protected static final class ConcurrentLinkedHashMap.Node<K,V>
extends java.lang.Object
implements java.io.Serializable

A node on the double-linked list. This list cross-cuts the data store.

See Also:
Serialized Form

Constructor Summary
ConcurrentLinkedHashMap.Node(K key, V value, ConcurrentLinkedHashMap.Node<K,V> sentinel, java.util.concurrent.locks.Lock lock)
          Creates a new, unlinked node.
ConcurrentLinkedHashMap.Node(java.util.concurrent.locks.Lock lock)
          Creates a new sentinel node.
 
Method Summary
 void appendToTail()
          Appends the node to the tail of the list.
 boolean casValue(V expect, V update)
           
 boolean equals(java.lang.Object obj)
          Only ensures that the values are equal, as the key may be null for look-ups.
 V getAndSetValue(V value)
           
 K getKey()
           
 ConcurrentLinkedHashMap.Node<K,V> getNext()
           
 ConcurrentLinkedHashMap.Node<K,V> getPrev()
           
 V getValue()
           
 int hashCode()
           
 boolean isMarked()
           
 boolean isTail()
          Checks whether the node is the last linked on the list chain.
 boolean isUnlinked()
          Checks whether the node is linked on the list chain.
 void moveToTail()
          Moves the node to the tail.
 void remove()
          Removes the node from the list.
 void setMarked(boolean marked)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConcurrentLinkedHashMap.Node

public ConcurrentLinkedHashMap.Node(java.util.concurrent.locks.Lock lock)
Creates a new sentinel node.


ConcurrentLinkedHashMap.Node

public ConcurrentLinkedHashMap.Node(K key,
                                    V value,
                                    ConcurrentLinkedHashMap.Node<K,V> sentinel,
                                    java.util.concurrent.locks.Lock lock)
Creates a new, unlinked node.

Method Detail

appendToTail

public void appendToTail()
Appends the node to the tail of the list.


remove

public void remove()
Removes the node from the list.

If the node has not yet been appended to the tail it will wait for that operation to complete.


moveToTail

public void moveToTail()
Moves the node to the tail.

If the node has been unlinked or is already at the tail, no-ops.


isUnlinked

public boolean isUnlinked()
Checks whether the node is linked on the list chain.

Returns:
Whether the node has not yet been linked on the list.

isTail

public boolean isTail()
Checks whether the node is the last linked on the list chain.

Returns:
Whether the node is at the tail of the list.

getKey

public K getKey()

getValue

public V getValue()

getAndSetValue

public V getAndSetValue(V value)

casValue

public boolean casValue(V expect,
                        V update)

getPrev

public ConcurrentLinkedHashMap.Node<K,V> getPrev()

getNext

public ConcurrentLinkedHashMap.Node<K,V> getNext()

isMarked

public boolean isMarked()

setMarked

public void setMarked(boolean marked)

equals

public boolean equals(java.lang.Object obj)
Only ensures that the values are equal, as the key may be null for look-ups.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

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


Copyright © 2008-2011 ThimbleWare. All Rights Reserved.