1 7 package org.jboss.cache.eviction; 8 9 import org.apache.commons.logging.Log; 10 import org.apache.commons.logging.LogFactory; 11 import org.jboss.cache.Region; 12 13 20 public class FIFOAlgorithm extends BaseEvictionAlgorithm 21 { 22 private static final Log log = LogFactory.getLog(FIFOAlgorithm.class); 23 24 25 public FIFOAlgorithm() 26 { 27 super(); 28 } 29 30 protected EvictionQueue setupEvictionQueue(Region region) throws EvictionException 31 { 32 return new FIFOQueue(); 33 } 34 35 38 protected boolean shouldEvictNode(NodeEntry ne) 39 { 40 FIFOConfiguration config = (FIFOConfiguration) region.getEvictionPolicyConfig(); 41 if (log.isTraceEnabled()) 42 { 43 log.trace("Deciding whether node in queue " + ne.getFqn() + " requires eviction."); 44 } 45 46 int size = this.getEvictionQueue().getNumberOfNodes(); 47 return config.getMaxNodes() != 0 && size > config.getMaxNodes(); 48 49 } 50 51 } 52 53 | Popular Tags |