1 package org.jboss.cache.eviction; 2 3 import org.jboss.cache.Region; 4 5 /** 6 * Interface for all eviction algorithms. 7 * <p/> 8 * Note: None of the Eviction classes are thread safe. It is assumed that an individual instance of an EvictionPolicy/ 9 * EvictionAlgorithm/EvictionQueue/EvictionConfiguration are only operated on by one thread at any given time. 10 * 11 * @author Ben Wang 2-2004 12 * @author Daniel Huang - dhuang@jboss.org - 10/2005 13 * @version $Revision: 1.4 $ 14 */ 15 public interface EvictionAlgorithm 16 { 17 /** 18 * Entry point for evictin algorithm. This is an api called by the EvictionTimerTask 19 * to process the node events in waiting and actual pruning, if necessary. 20 * 21 * @param region MarshRegion that this algorithm will operate on. 22 */ 23 void process(Region region) throws EvictionException; 24 25 /** 26 * Reset the whole eviction queue. Queue may needs to be reset due to corrupted state, for example. 27 * 28 * @param region MarshRegion that this algorithm will operate on. 29 */ 30 void resetEvictionQueue(Region region); 31 32 /** 33 * Get the EvictionQueue implementation used by this algorithm. 34 * 35 * @return the EvictionQueue implementation. 36 */ 37 EvictionQueue getEvictionQueue(); 38 39 } 40