org.jboss.cache.eviction
Class NullEvictionPolicy

java.lang.Object
  extended by org.jboss.cache.eviction.NullEvictionPolicy
All Implemented Interfaces:
EvictionPolicy

public class NullEvictionPolicy
extends Object
implements EvictionPolicy

Eviction policy that does nothing and always tells the eviction interceptor an event can be ignored, saving the overhead of constructing and processing event objects. Basically useful as a default policy for a cache or subtree that is shared between multiple usages, some of which don't want eviction.

Author:
Brian Stansberry

Constructor Summary
NullEvictionPolicy()
           
 
Method Summary
 boolean canIgnoreEvent(Fqn fqn, NodeEventType eventType)
          Returns true
 void evict(Fqn fqn)
          No-op
 CacheSPI getCache()
           
 EvictionAlgorithm getEvictionAlgorithm()
          Returns NullEvictionAlgorithm.INSTANCE.
 Class<? extends EvictionPolicyConfig> getEvictionConfigurationClass()
          Returns NullEvictionPolicyConfig.
 void setCache(CacheSPI cache)
          Method called to set the cache in this implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullEvictionPolicy

public NullEvictionPolicy()
Method Detail

canIgnoreEvent

public boolean canIgnoreEvent(Fqn fqn,
                              NodeEventType eventType)
Returns true

Specified by:
canIgnoreEvent in interface EvictionPolicy
Parameters:
fqn - The Fqn of the node associated with the event.
eventType - the type of the event
Returns:
true to ignore events of this type for this Fqn, false to process events normally.

evict

public void evict(Fqn fqn)
           throws Exception
No-op

Specified by:
evict in interface EvictionPolicy
Parameters:
fqn - DataNode corresponds to this fqn.
Throws:
Exception

getEvictionAlgorithm

public EvictionAlgorithm getEvictionAlgorithm()
Returns NullEvictionAlgorithm.INSTANCE.

Specified by:
getEvictionAlgorithm in interface EvictionPolicy
Returns:
An EvictionAlgorithm implementation.

getEvictionConfigurationClass

public Class<? extends EvictionPolicyConfig> getEvictionConfigurationClass()
Returns NullEvictionPolicyConfig.

Specified by:
getEvictionConfigurationClass in interface EvictionPolicy
Returns:
EvictionPolicyConfig implementation class.

getCache

public CacheSPI getCache()
Specified by:
getCache in interface EvictionPolicy
Returns:
the CacheSPI instance this eviction policy is configured to work on.

setCache

public void setCache(CacheSPI cache)
Description copied from interface: EvictionPolicy
Method called to set the cache in this implementation.

Specified by:
setCache in interface EvictionPolicy
Parameters:
cache - the cache to set


Copyright © 2008 JBoss, a division of Red Hat. All Rights Reserved.