/**
   * return the head entry in the list preserving the cupipe requirement of at least one entry left
   * in the list
   */
  private LRUClockNode getHeadEntry() {
    synchronized (lock) {
      LRUClockNode aNode = NewLRUClockHand.this.head.nextLRUNode();
      if (aNode == this.tail) {
        return null;
      }

      LRUClockNode next = aNode.nextLRUNode();
      this.head.setNextLRUNode(next);
      next.setPrevLRUNode(this.head);

      aNode.setNextLRUNode(null);
      aNode.setPrevLRUNode(null);
      this.size++;
      return aNode;
    }
  }
 /** remove an entry from the pipe... (marks it evicted to be skipped later) */
 public boolean unlinkEntry(LRUClockNode entry) {
   if (logger.isTraceEnabled(LogMarker.LRU_CLOCK)) {
     logger.trace(
         LogMarker.LRU_CLOCK,
         LocalizedMessage.create(LocalizedStrings.NewLRUClockHand_UNLINKENTRY_CALLED, entry));
   }
   entry.setEvicted();
   stats().incDestroys();
   synchronized (lock) {
     LRUClockNode next = entry.nextLRUNode();
     LRUClockNode prev = entry.prevLRUNode();
     if (next == null || prev == null) {
       // not in the list anymore.
       return false;
     }
     next.setPrevLRUNode(prev);
     prev.setNextLRUNode(next);
     entry.setNextLRUNode(null);
     entry.setPrevLRUNode(null);
   }
   return true;
 }
  /**
   * Adds a new lru node for the entry between the current tail and head of the list.
   *
   * @param aNode Description of the Parameter
   */
  public final void appendEntry(final LRUClockNode aNode) {
    synchronized (this.lock) {
      if (aNode.nextLRUNode() != null || aNode.prevLRUNode() != null) {
        return;
      }

      if (logger.isTraceEnabled(LogMarker.LRU_CLOCK)) {
        logger.trace(
            LogMarker.LRU_CLOCK,
            LocalizedMessage.create(
                LocalizedStrings.NewLRUClockHand_ADDING_ANODE_TO_LRU_LIST, aNode));
      }
      aNode.setNextLRUNode(this.tail);
      this.tail.prevLRUNode().setNextLRUNode(aNode);
      aNode.setPrevLRUNode(this.tail.prevLRUNode());
      this.tail.setPrevLRUNode(aNode);

      this.size++;
    }
  }