public long getExpensiveListCount() { synchronized (lock) { long count = 0; for (LRUClockNode aNode = this.head.nextLRUNode(); aNode != this.tail; aNode = aNode.nextLRUNode()) { count++; } return count; } }
public long getExpensiveListCount() { synchronized (lock) { long count = 0; for (LRUClockNode aNode = this.head.nextLRUNode(); aNode != this.tail; aNode = aNode.nextLRUNode()) { count++; } return count; } }
public void dumpList(LogWriterI18n log) { synchronized (lock) { int idx=1; for (LRUClockNode aNode = this.head; aNode != null; aNode = aNode.nextLRUNode()) { log.fine(" " + (idx++) + ") " + aNode); } } }
public void dumpList() { final boolean isDebugEnabled = logger.isTraceEnabled(LogMarker.LRU_CLOCK); if (!isDebugEnabled) { return; } synchronized (lock) { int idx=1; for (LRUClockNode aNode = this.head; aNode != null; aNode = aNode.nextLRUNode()) { if (isDebugEnabled) { logger.trace(LogMarker.LRU_CLOCK, " ({}) {}", (idx++), 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(); }
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(); }
/** 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 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; } }
/** * 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++; } }
/** 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; }
/** * 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 (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; }