/** 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); }
LRUClockNode entry = getANode( i ); 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();
public void testRemoveMiddle() 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[5]); for( i = 0; i < 5; i ++ ) { LRUTestEntry n = (LRUTestEntry) clock.getLRUEntry( ); assertTrue( "expected nodes[" + nodes[i].id() + "], found nodes[" + n.id() + "]", n == nodes[i] ); } for( i = 6; 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( )); }
public void testEvicted() throws Exception { NewLRUClockHand clock = getAClockHand( getARegion(), new TestEnableLRU() ); // getLRUEntry( maxScan ) LRUTestEntry[] nodes = new LRUTestEntry[10]; int i = 0; for( i = 0; i < 10; i++ ) { nodes[i] = getANode( i ); clock.appendEntry( nodes[i] ); } for( i = 0; i < 10; i += 2 ) { clock.unlinkEntry( nodes[i] ); } // getLRUEntry until empty... verify order of results. for( i = 1; i < 10; i += 2 ) { LRUTestEntry n = (LRUTestEntry) clock.getLRUEntry( ); assertTrue( "expected nodes[" + nodes[i].id() + "], found nodes[" + n.id() + "]", n == nodes[i] ); } assertTrue( "expected null", clock.getLRUEntry( ) == null ); }
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( )); }
public void testRemoveTail() 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[9]); for( i = 0; i < 9; i ++ ) { LRUTestEntry n = (LRUTestEntry) clock.getLRUEntry( ); assertTrue( "expected nodes[" + nodes[i].id() + "], found nodes[" + n.id() + "]", n == nodes[i] ); } assertEquals(null, clock.getLRUEntry( )); }
/** * A unit test for JUnit * * @exception Exception Description of the Exception */ public void testAddToClockFace() throws Exception { NewLRUClockHand clock = getAClockHand( getARegion(), new TestEnableLRU() ); // getLRUEntry( maxScan ) LRUTestEntry[] nodes = new LRUTestEntry[10]; int i = 0; for( i = 0; i < 10; i++ ) { nodes[i] = getANode( i ); clock.appendEntry( nodes[i] ); } // getLRUEntry until empty... verify order of results. for( i = 0; i < 10; i++ ) { LRUTestEntry n = (LRUTestEntry) clock.getLRUEntry( ); assertTrue( "expected nodes[" + nodes[i].id() + "], found nodes[" + n.id() + "]", n == nodes[i] ); } assertTrue( "expected null", clock.getLRUEntry( ) == null ); }
/** * Overridden getLRUEntry method */ public LRUClockNode getLRUEntry() { if (EXECUTE_AFTER_GET_CALL) { Cache cache = CacheFactory.getAnyInstance(); Assert.assertTrue(cache != null); LocalRegion region = (LocalRegion)cache.getRegion(regionName); Assert.assertTrue(region != null); Thread clearThread = new Thread(new clearThread(region)); clearThread.start(); try { synchronized (mutex) { mutex.wait(10000); } } catch (InterruptedException ie) { if (cache.getLogger().fineEnabled()) { cache.getLogger().fine( "TestLRUClockHand#getLRUEntry Got an interrupted Exception"); } fail("interrupted"); } } LRUClockNode aNode = super.getLRUEntry(); return aNode; }
LRUTestEntry n = (LRUTestEntry) clock.getLRUEntry( ); assertTrue( "expected nodes[" + nodes[i].id() + "], found nodes[" + n.id() + "]", n == nodes[i] ); LRUTestEntry n = (LRUTestEntry) clock.getLRUEntry( ); assertTrue( "expected nodes[" + nodes[i].id() + "], found nodes[" + n.id() + "]", n == nodes[i] ); assertTrue( "expected null", clock.getLRUEntry( ) == null );
try { while (mustEvict() && evictedBytes == 0) { LRUEntry removalEntry = (LRUEntry)_getLruList().getLRUEntry(); if (removalEntry != null) { evictedBytes = evictEntry(removalEntry, stats);
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) {
(includeOffHeapBytes && offHeapSize == 0))) { buffer = null; removalEntry = (LRUEntry)lruList.getLRUEntry(skipped); if (removalEntry != null) {
assertNull( "The LRU List should have been empty instead it contained a cleared entry", lruList.getLRUEntry());
removalEntry = (LRUEntry)lruList.getLRUEntry(skipped); if (removalEntry != null) { int sizeOfValue = evictEntry(removalEntry, stats); removalEntry = (LRUEntry)lruList.getLRUEntry(skipped); if (removalEntry != null) { if (evictEntry(removalEntry, stats) != 0) {