/** * Peeks into the cache's internals to verify that its expiration queue is consistent. Verifies * that the next/prev links in the expiration queue are correct, and that the queue is ordered by * expiration time. */ static void checkExpiration(Cache<?, ?> cache) { if (hasLocalCache(cache)) { checkExpiration(toLocalCache(cache)); } }
static void checkValidState(LocalCache<?, ?> cchm) { for (Segment<?, ?> segment : cchm.segments) { segment.cleanUp(); assertFalse(segment.isLocked()); Map<?, ?> table = segmentTable(segment); // cleanup and then check count after we have a strong reference to all entries segment.cleanUp(); // under high memory pressure keys/values may be nulled out but not yet enqueued assertThat(table.size()).isAtMost(segment.count); for (Entry<?, ?> entry : table.entrySet()) { assertNotNull(entry.getKey()); assertNotNull(entry.getValue()); assertSame(entry.getValue(), cchm.get(entry.getKey())); } } checkEviction(cchm); checkExpiration(cchm); }
/** * Peeks into the cache's internals to verify that its expiration queue is consistent. Verifies * that the next/prev links in the expiration queue are correct, and that the queue is ordered * by expiration time. */ static void checkExpiration(Cache<?, ?> cache) { if (hasLocalCache(cache)) { checkExpiration(toLocalCache(cache)); } }
static void checkValidState(LocalCache<?, ?> cchm) { for (Segment<?, ?> segment : cchm.segments) { segment.cleanUp(); assertFalse(segment.isLocked()); Map<?, ?> table = segmentTable(segment); // cleanup and then check count after we have a strong reference to all entries segment.cleanUp(); // under high memory pressure keys/values may be nulled out but not yet enqueued assertThat(table.size()).isAtMost(segment.count); for (Entry<?, ?> entry : table.entrySet()) { assertNotNull(entry.getKey()); assertNotNull(entry.getValue()); assertSame(entry.getValue(), cchm.get(entry.getKey())); } } checkEviction(cchm); checkExpiration(cchm); }