com.googlecode.ehcache.annotations.impl
Class ExpiredElementEvictor

java.lang.Object
  extended by java.util.TimerTask
      extended by com.googlecode.ehcache.annotations.impl.ExpiredElementEvictor
All Implemented Interfaces:
java.lang.Runnable, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

public final class ExpiredElementEvictor
extends java.util.TimerTask
implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

TimerTask implementation that depends on a CacheManager reference. When run() is invoked, Ehcache.evictExpiredElements() is invoked on each cache identified by the cacheNames field.

Version:
$Id: ExpiredElementEvictor.java 656 2011-04-21 19:54:27Z eric.dalquist@gmail.com $
Author:
Nicholas Blair

Constructor Summary
ExpiredElementEvictor()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  java.util.Set<java.lang.String> calculateEvictableCacheNames(java.lang.String[] cacheManagerCacheNames)
           
 void destroy()
           
 java.util.List<CacheNameMatcher> getCacheNameMatchers()
           
 int getInterval()
           
 void run()
           
 void setCacheManager(net.sf.ehcache.CacheManager cacheManager)
           
 void setCacheNameMatchers(java.util.List<CacheNameMatcher> cacheNameMatchers)
           
 void setInterval(int interval)
           
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpiredElementEvictor

public ExpiredElementEvictor()
Method Detail

setCacheManager

public void setCacheManager(net.sf.ehcache.CacheManager cacheManager)
Parameters:
cacheManager - the cacheManager to set

setCacheNameMatchers

public void setCacheNameMatchers(java.util.List<CacheNameMatcher> cacheNameMatchers)
Parameters:
cacheNameMatchers - the cacheNameMatchers to set

setInterval

public void setInterval(int interval)
Parameters:
interval - the interval evict expired elements, in minutes

getCacheNameMatchers

public java.util.List<CacheNameMatcher> getCacheNameMatchers()
Returns:
the cacheNameMatchers

getInterval

public int getInterval()
Returns:
the interval

run

public void run()
Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

destroy

public void destroy()
             throws java.lang.Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
java.lang.Exception

calculateEvictableCacheNames

protected java.util.Set<java.lang.String> calculateEvictableCacheNames(java.lang.String[] cacheManagerCacheNames)
Returns:
Get the set of caches to do eviction for based on the full array of cache names in the cache manager


Copyright © 2011. All Rights Reserved.