Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 88   Methods: 0
NCLOC: 13   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
EvictionPolicy.java - - - -
coverage
 1    /*
 2    * JBoss, the OpenSource J2EE webOS
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache.eviction;
 8   
 9    import org.jboss.cache.CacheSPI;
 10    import org.jboss.cache.Fqn;
 11    import org.jboss.cache.config.EvictionPolicyConfig;
 12   
 13    /**
 14    * Generic eviction policy interface.
 15    * <p/>
 16    * None of the Eviction classes are thread safe. It is assumed that an individual instance of an EvictionPolicy/
 17    * EvictionAlgorithm/EvictionQueue/EvictionConfiguration are only operated on by one thread at any given time.
 18    *
 19    * @author Ben Wang 2-2004
 20    * @author Daniel Huang - dhuang@jboss.org - 10/2005
 21    */
 22    public interface EvictionPolicy
 23    {
 24    /**
 25    * Evict a node form the underlying cache.
 26    *
 27    * @param fqn DataNode corresponds to this fqn.
 28    * @throws Exception
 29    */
 30    void evict(Fqn fqn) throws Exception;
 31   
 32    /**
 33    * @return the CacheSPI instance this eviction policy is configured to work on.
 34    */
 35    CacheSPI getCache();
 36   
 37    /**
 38    * Method called to set the cache in this implementation.
 39    *
 40    * @param cache the cache to set
 41    */
 42    void setCache(CacheSPI cache);
 43   
 44    /**
 45    * Get the associated EvictionAlgorithm used by the EvictionPolicy.
 46    * <p/>
 47    * This relationship should be 1-1.
 48    *
 49    * @return An EvictionAlgorithm implementation.
 50    */
 51    EvictionAlgorithm getEvictionAlgorithm();
 52   
 53    /**
 54    * The EvictionPolicyConfig implementation class used by this EvictionPolicy.
 55    *
 56    * @return EvictionPolicyConfig implementation class.
 57    */
 58    Class<? extends EvictionPolicyConfig> getEvictionConfigurationClass();
 59   
 60    /**
 61    * This method will be invoked prior to an event being processed for a node
 62    * with the specified Fqn.
 63    * <p/>
 64    * This method provides a way to optimize the performance of eviction by
 65    * signalling that the node associated with the specified Fqn should not be
 66    * subject to normal eviction processing. It can also be used to filter
 67    * out certain {@link NodeEventType event types} in which the particular
 68    * eviction algorithm has no interest.
 69    * </p>
 70    * <p/>
 71    * If this method returns false then the event is processed normally
 72    * and eviction processing for the node continues. As a result, the event
 73    * will be added to the {@link org.jboss.cache.Region eviction region's} event queue where
 74    * at some later point the particular algorithm of the eviction policy
 75    * can use it to decide whether to call {@link #evict(Fqn)}.
 76    * </p>
 77    * <p/>
 78    * If this method returns true, then the event is ignored and will not factor
 79    * in any subsequent eviction processing.
 80    * </p>
 81    *
 82    * @param fqn The Fqn of the node associated with the event.
 83    * @param eventType the type of the event
 84    * @return <code>true</code> to ignore events of this type for this Fqn,
 85    * <code>false</code> to process events normally.
 86    */
 87    boolean canIgnoreEvent(Fqn fqn, NodeEventType eventType);
 88    }