protected LRUClockNode getTailEntry() { LRUClockNode aNode = null; synchronized (this.lock) { aNode = this.tail.prevLRUNode(); if (aNode == this.head) { return null; //end of lru list } //remove entry from list LRUClockNode prev = aNode.prevLRUNode(); prev.setNextLRUNode(this.tail); this.tail.setPrevLRUNode(prev); aNode.setNextLRUNode(null); aNode.setPrevLRUNode(null); super.size--; } return aNode; }
/** 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; } }
/** return the head entry in the list preserving the cupipe requirement of at * least one entry left in the list */ protected LRUClockNode getNextEntry() { 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; } }
/** * return the tail entry in the list preserving the requirement of at least * one entry left in the list */ @Override protected LRUClockNode getNextEntry() { synchronized (lock) { LRUClockNode aNode = this.tail.prevLRUNode(); if (aNode == this.head) { return null; } LRUClockNode prev = aNode.prevLRUNode(); this.tail.setPrevLRUNode(prev); prev.setNextLRUNode(this.tail); aNode.setNextLRUNode(null); aNode.setPrevLRUNode(null); this.size--; return aNode; } }
private void initHeadAndTail() { //I'm not sure, but I think it's important that we //drop the references to the old head and tail on a region clear //That will prevent any concurrent operations that are messing //with existing nodes from screwing up the head and tail after //the clear. //Dan 9/23/09 this.head = new GuardNode(); this.tail = new GuardNode(); this.head.setNextLRUNode(this.tail); this.tail.setPrevLRUNode(this.head); this.size = 0; }
private void initHeadAndTail() { //I'm not sure, but I think it's important that we //drop the references to the old head and tail on a region clear //That will prevent any concurrent operations that are messing //with existing nodes from screwing up the head and tail after //the clear. //Dan 9/23/09 this.head = new GuardNode(); this.tail = new GuardNode(); this.head.setNextLRUNode(this.tail); this.tail.setPrevLRUNode(this.head); this.size = 0; }
/** * 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++; } }
/** * 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 (debug) { logWriter .info(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++; } }
/** 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); this.size--; } return true; }
/** remove an entry from the pipe... (marks it evicted to be skipped later) */ public boolean unlinkEntry(LRUClockNode entry) { if (debug) { logWriter.info(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; }