/** * 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++; } }
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 */ 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; } }
public String getAuditReport( ) { LRUClockNode h = this.head; int totalNodes = 0; int evictedNodes = 0; int usedNodes = 0; while( h != null ) { totalNodes++; if ( h.testEvicted() ) evictedNodes++; if ( h.testRecentlyUsed() ) usedNodes++; h = h.nextLRUNode(); } StringBuffer result = new StringBuffer(128); result.append("LRUList Audit: listEntries = ") .append(totalNodes) .append(" evicted = ") .append(evictedNodes) .append(" used = ") .append(usedNodes); return result.toString(); }
if (aNode.testEvicted()) { if (logger.isTraceEnabled(LogMarker.LRU_CLOCK)) { logger.trace(LogMarker.LRU_CLOCK, LocalizedMessage.create(LocalizedStrings.NewLRUClockHand_DISCARDING_EVICTED_ENTRY)); if ( aNode.testRecentlyUsed()) { aNode.unsetRecentlyUsed();
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; }
protected boolean checkRecentlyUsed(LRUClockNode aNode) { if (aNode.testRecentlyUsed()) { // Throw it back, it's in the working set aNode.unsetRecentlyUsed(); // aNode.setInList(); if (debug) { logWriter.info(LocalizedStrings .NewLRUClockHand_SKIPPING_RECENTLY_USED_ENTRY, aNode); } appendEntry(aNode); return true; } else { return false; } }
public long getExpensiveListCount() { synchronized (lock) { long count = 0; for (LRUClockNode aNode = this.head.nextLRUNode(); aNode != this.tail; aNode = aNode.nextLRUNode()) { count++; } return count; } }
if (ExclusiveSharedSynchronizer.isWrite(aNode.getState())) { if (debug) { logWriter.info(LocalizedStrings if (aNode.testEvicted()) { if (debug) { logWriter
change = ((LRUClockNode)entry).updateEntrySize(ccHelper);
@Override public LRUClockNode getLRUEntry() { long numEvals = 0; LRUClockNode aNode = null; //search for entry to return from list for (;;) { aNode = getTailEntry(); //end of Lifo list stop searching if (aNode == null) { break; } numEvals++; synchronized (aNode) { //look for another entry if in transaction boolean inUseByTransaction = false; if (aNode instanceof AbstractRegionEntry) { if (((AbstractRegionEntry) aNode).isInUseByTransaction()) { inUseByTransaction=true; } } //if entry NOT used by transaction and NOT evicted return entry if (!inUseByTransaction && !aNode.testEvicted()) { break; } } } this.stats().incEvaluations(numEvals); 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; } }
/** 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; } }
public String getAuditReport( ) { LRUClockNode h = this.head; int totalNodes = 0; int evictedNodes = 0; int usedNodes = 0; while( h != null ) { totalNodes++; if ( h.testEvicted() ) evictedNodes++; if ( h.testRecentlyUsed() ) usedNodes++; h = h.nextLRUNode(); } StringBuilder result = new StringBuilder(128); result.append("LRUList Audit: listEntries = ") .append(totalNodes) .append(" evicted = ") .append(evictedNodes) .append(" used = ") .append(usedNodes); return result.toString(); }
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; }
public long getExpensiveListCount() { synchronized (lock) { long count = 0; for (LRUClockNode aNode = this.head.nextLRUNode(); aNode != this.tail; aNode = aNode.nextLRUNode()) { count++; } return count; } }
change = ((LRUClockNode)entry).updateEntrySize(ccHelper);
/** * 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++; } }
public void dumpList(LogWriterI18n log) { synchronized (lock) { int idx=1; for (LRUClockNode aNode = this.head; aNode != null; aNode = aNode.nextLRUNode()) { log.fine(" " + (idx++) + ") " + aNode); } } }
/** 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; }