public final LRUStatistics getLRUStatistics() { return _getLruList().stats(); }
/** overridden in SharedLRUClockTest to test SharedLRUClockHand */ protected NewLRUClockHand getAClockHand( Region reg, EnableLRU elru ) { return new NewLRUClockHand( reg, elru,new InternalRegionArguments()); }
public void testRemoveHead() throws Exception { NewLRUClockHand clock = getAClockHand( getARegion(), new TestEnableLRU() ); LRUTestEntry[] nodes = new LRUTestEntry[10]; int i = 0; for( i = 0; i < 10; i++ ) { nodes[i] = getANode( i ); clock.appendEntry( nodes[i] ); } clock.unlinkEntry(nodes[0]); for( i = 1; i < 10; i ++ ) { LRUTestEntry n = (LRUTestEntry) clock.getLRUEntry( ); assertTrue( "expected nodes[" + nodes[i].id() + "], found nodes[" + n.id() + "]", n == nodes[i] ); } assertEquals(null, clock.getLRUEntry( )); }
clock.appendEntry( entry ); clock.appendEntry( entry ); Object obj = clock.getLRUEntry(); if ( obj instanceof LRUTestEntry ) { LRUTestEntry le = (LRUTestEntry) obj; LRUTestEntry le = (LRUTestEntry) clock.getLRUEntry(); while( le != null ) { counter++; le = (LRUTestEntry) clock.getLRUEntry();
debugLogging("lruUpdateCallback" + "; list size is: " + getTotalEntrySize() + "; actual size is: " + lruList.getExpensiveListCount() + "; map size is: " + sizeInVM() + "; delta is: " + delta + "; limit is: " + getLimit() LRUStatistics stats = lruList.stats(); if (owner == null) { changeTotalEntrySize(delta); removalEntry = (LRUEntry)lruList.getLRUEntry(skipped); if (removalEntry != null) { int sizeOfValue = evictEntry(removalEntry, stats); lruList.appendEntry(skipped.get(i)); removalEntry = (LRUEntry)lruList.getLRUEntry(skipped); if (removalEntry != null) { if (evictEntry(removalEntry, stats) != 0) { lruList.appendEntry(skipped.get(i));
final ArrayList<LRUClockNode> skipped = skipLockedEntries ? new ArrayList<>(2) : null; LRUStatistics stats = lruList.stats(); LRUEntry removalEntry = null; SerializedDiskBuffer buffer = null; (includeOffHeapBytes && offHeapSize == 0))) { buffer = null; removalEntry = (LRUEntry)lruList.getLRUEntry(skipped); if (removalEntry != null) { lruList.appendEntry(skipped.get(i));
logger.trace(LogMarker.LRU, "lruUpdateCallback; list size is: {}; actual size is: {}; map size is: {}; delta is: {}; limit is: {}; tombstone count={}", getTotalEntrySize(), this._getLruList().getExpensiveListCount(), size(), delta, getLimit(), _getOwner().getTombstoneCount()); LRUStatistics stats = _getLruList().stats(); if (!_isOwnerALocalRegion()) { changeTotalEntrySize(delta); LRUEntry removalEntry = (LRUEntry)_getLruList().getLRUEntry(); if (removalEntry != null) { int sizeOfValue = evictEntry(removalEntry, stats); LRUEntry removalEntry = (LRUEntry)_getLruList().getLRUEntry(); if (removalEntry != null) { if (evictEntry(removalEntry, stats) != 0) { logger.trace(LogMarker.LRU, "callback complete. LRU size is now {}", _getLruList().stats().getCounter());
/** Called by DiskEntry.Helper.faultInValue */ @Override public final void lruEntryFaultIn(LRUEntry e) { if (debug) debugLogging("lruEntryFaultIn for key=" + e.getKeyCopy() + " size=" + e.getEntrySize()); NewLRUClockHand lruList = _getLruList(); if (_isOwnerALocalRegion()) { LocalRegion owner = _getOwner(); DiskRegion disk = owner.getDiskRegion(); boolean possibleClear = disk != null && disk.didClearCountChange(); if (!possibleClear || owner.basicGetEntry(e.getKey()) == e) { lruEntryUpdate(e); e.unsetEvicted(); lruList.appendEntry(e); } } else { lruEntryUpdate(e); lruList.appendEntry(e); } lruList.stats().incFaultins(); }
logger.trace(LogMarker.LRU, "centralLruUpdateCallback: lru size is now {}, limit is: {}", getTotalEntrySize(), getLimit()); LRUStatistics stats = _getLruList().stats(); try { while (mustEvict() && evictedBytes == 0) { LRUEntry removalEntry = (LRUEntry)_getLruList().getLRUEntry(); if (removalEntry != null) { evictedBytes = evictEntry(removalEntry, stats);
._getLruList(); assertEquals(region.size(), 0); lruList.audit(); assertNull( "The LRU List should have been empty instead it contained a cleared entry", lruList.getLRUEntry());
@Override public final synchronized void resetRefCount(NewLRUClockHand lruList) { if (isInUseByTransaction()) { setInUseByTransaction(false); if (lruList != null) { lruList.appendEntry((LRUClockNode)this); } } } /**
@Override protected final void lruEntryCreate(RegionEntry re) { LRUEntry e = (LRUEntry)re; // Assert.assertFalse(e._getValue() instanceof DiskEntry.RecoveredEntry) if (logger.isTraceEnabled(LogMarker.LRU)) { logger.trace(LogMarker.LRU, "lruEntryCreate for key={}; list size is: {}; actual size is: {}; map size is: {}; entry size: {}; in lru clock: {}", re.getKey(), getTotalEntrySize(), this._getLruList().getExpensiveListCount(), size(), e.getEntrySize(), !e.testEvicted()); } // this.lruCreatedKey = re.getKey(); // [ bruce ] for DEBUGGING only e.unsetEvicted(); NewLRUClockHand lruList = _getLruList(); DiskRegion disk = _getOwner().getDiskRegion(); boolean possibleClear = disk != null && disk.didClearCountChange(); if(!possibleClear || this._getOwner().basicGetEntry(re.getKey()) == re ) { lruList.appendEntry(e); lruEntryUpdate(e); } }
@Override protected final void lruEntryDestroy(RegionEntry re) { final LRUEntry e = (LRUEntry)re; if (logger.isTraceEnabled(LogMarker.LRU)) { logger.trace(LogMarker.LRU, "lruEntryDestroy for key={}; list size is: {}; actual size is: {}; map size is: {}; entry size: {}; in lru clock: {}", re.getKey(), getTotalEntrySize(), this._getLruList().getExpensiveListCount(), size(), e.getEntrySize(), !e.testEvicted()); } // if (this.lruCreatedKey == re.getKey()) { // String method = Thread.currentThread().getStackTrace()[5].getMethodName(); // } // boolean wasEvicted = e.testEvicted(); /*boolean removed = */_getLruList().unlinkEntry(e); // if (removed || wasEvicted) { // evicted entries have already been removed from the list changeTotalEntrySize(-1 * e.getEntrySize());// subtract the size. Token vTok = re.getValueAsToken(); if (vTok == Token.DESTROYED || vTok == Token.TOMBSTONE) { // OFFHEAP noop TODO: use re.isDestroyedOrTombstone // if in token mode we need to recalculate the size of the entry since it's // staying in the map and may be resurrected e.updateEntrySize(_getCCHelper()); } // } else if (debug) { // debugLogging("entry not removed from LRU list"); // } } /** Called by DiskEntry.Helper.faultInValue
aNode = getNextEntry(); .NewLRUClockHand_REMOVING_TRANSACTIONAL_ENTRY_FROM_CONSIDERATION); appendEntry(aNode); continue; if (checkRecentlyUsed(aNode)) { continue; // keep looking
aNode = getHeadEntry(); logger.trace(LogMarker.LRU_CLOCK, LocalizedMessage.create(LocalizedStrings.NewLRUClockHand_SKIPPING_RECENTLY_USED_ENTRY, aNode)); appendEntry(aNode); continue; // keep looking
/** unsafe audit code. */ public final void audit( ) { if (logger.isTraceEnabled(LogMarker.LRU)) { logger.trace(LogMarker.LRU, "Size of LRUMap = {}", sizeInVM() ); } _getLruList().audit(); }
/** return the Entry that is considered least recently used. The entry will no longer * be in the pipe (unless it is the last empty marker). */ public LRUClockNode getLRUEntry() { return getLRUEntry(null); }
/** Description of the Method */ public void close() { closeStats(); if(bucketRegion!=null) bucketRegion.close(); }
@Override public final Set<VersionSource> clear(RegionVersionVector rvv) { _getLruList().clear(rvv); return super.clear(rvv); }
/** unsynchronized audit...only run after activity has ceased. */ public void audit( ) { System.out.println(getAuditReport()); }