AbstractEvictionList implements EvictionList { protected boolean isEvictable(EvictionNode evictionNode) { if (evictionNode.isEvicted()) { if (logger.isTraceEnabled(LogMarker.LRU_CLOCK_VERBOSE)) { logger.trace(LogMarker.LRU_CLOCK_VERBOSE, "discarding evicted entry"); } return false; } synchronized (evictionNode) { if (evictionNode.isInUseByTransaction()) { if (logger.isTraceEnabled(LogMarker.LRU_CLOCK_VERBOSE)) { logger.trace(LogMarker.LRU_CLOCK_VERBOSE, "removing transactional entry from consideration"); } return false; } } return true; } protected  AbstractEvictionList(EvictionController controller); @Override int size(); @Override void closeStats(); @Override EvictionCounters getStatistics(); @Override void clear(RegionVersionVector regionVersionVector, BucketRegion bucketRegion); @Override synchronized void appendEntry(final EvictionNode evictionNode); @Override synchronized void destroyEntry(EvictionNode evictionNode);  }
@Test public void nodeUsedByTransactionIsNotEvictable() { TestEvictionList evictionList = new TestEvictionList(controller); EvictionNode node = mock(EvictionNode.class); when(node.isInUseByTransaction()).thenReturn(true); assertThat(evictionList.isEvictable(node)).isFalse(); }
@Test public void evictedNodeIsNotEvictable() { TestEvictionList evictionList = new TestEvictionList(controller); EvictionNode node = mock(EvictionNode.class); when(node.isEvicted()).thenReturn(true); assertThat(evictionList.isEvictable(node)).isFalse(); }
@Test public void defaultNodeIsEvictable() { TestEvictionList evictionList = new TestEvictionList(controller); EvictionNode node = mock(EvictionNode.class); assertThat(evictionList.isEvictable(node)).isTrue(); }