com.jcorporate.expresso.core.cache
Class CacheCleaner
java.lang.Object
java.lang.Thread
com.jcorporate.expresso.core.cache.CacheCleaner
- All Implemented Interfaces:
- Runnable
- public class CacheCleaner
- extends Thread
This thread is initialized by CacheManager and slowly iterates through the
Caches clearing out expired items. It often is given a lower thread priority
so it doesn't take away from the app server during high use times.
By using this thread, we save significant memory by removing expired items before
they are accessed again.
Typical Usage:
CacheCleaner cacheCleaner = new CacheCleaner();
cacheCleaner.registerCacheSystem(defaultContextCacheSystem);
cacheCleaner.start();
.....
.....
//To shut down. May take a while.
cacheCleaner.interrupt();
cacheCleaner.join();
- Version:
- $Revision: 1.6 $ on $Date: 2003/12/13 23:39:52 $
- Author:
- Michael Rimov
|
Method Summary |
void |
interrupt()
|
static void |
main(String[] args)
|
void |
registerCacheSystem(CacheSystem newCache)
Register a cache system for iteration. |
void |
run()
The cache cleaner run method iterates through all the cache systems installed
in the system and forces the removal of any items that have expired. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
CacheCleaner
protected CacheCleaner()
main
public static void main(String[] args)
registerCacheSystem
public void registerCacheSystem(CacheSystem newCache)
- Register a cache system for iteration. During a pass of the cache,
the CacheCleaner will iterate all registered CacheSystems
- Parameters:
newCache - the CacheSystem instance to be cleaning.
run
public void run()
- The cache cleaner run method iterates through all the cache systems installed
in the system and forces the removal of any items that have expired. It
automatically runs every 30 seconds.
interrupt
public void interrupt()
Please see www.jcorporate.com for information about new Expresso releases.