| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.components.store.impl.StoreJanitorImpl
public class StoreJanitorImpl
This class is a implentation of a StoreJanitor. Store classes can register to the StoreJanitor. When memory is too low, the StoreJanitor frees the registered caches until memory is normal.
A few parameters can be used:
cleanupthreadinterval defines the maximum cleanup interval.
      Cleanup interval then is determined based on the memory fill rate: the faster memory is filled in,
      and the less free memory is left, the shorter is the cleanup time.
| Field Summary | |
|---|---|
| protected  long | intervalThe calculated delay for the next checker run in ms | 
| protected  long | inUseAmount of memory in use before sleep(). | 
| protected  boolean | invokeGCShould the gc be called on low memory? | 
| Fields inherited from interface org.apache.excalibur.store.StoreJanitor | 
|---|
| ROLE | 
| Constructor Summary | |
|---|---|
| StoreJanitorImpl() | |
| Method Summary | |
|---|---|
| protected  void | checkMemory()The "checker" thread checks if memory is running low in the jvm. | 
|  Iterator | iterator()This method return a java.util.Iterator of every registered stores The iterators returned is fail-fast: if list is structurally modified at any time after the iterator is created, in any way, the iterator will throw a ConcurrentModificationException. | 
| protected  long | memoryInUse()Calculate the JVM memory in use now. | 
|  void | parameterize(Parameters params)Parameterize the StoreJanitorImpl. | 
|  void | register(Store store)This method register the stores | 
|  void | run()The "checker" thread loop. | 
|  void | start() | 
|  void | stop() | 
|  void | unregister(Store store)This method unregister the stores | 
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled | 
|---|
| enableLogging, getLogger, setupLogger, setupLogger, setupLogger | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected boolean invokeGC
protected long inUse
memoryInUse()
protected long interval
| Constructor Detail | 
|---|
public StoreJanitorImpl()
| Method Detail | 
|---|
public void parameterize(Parameters params)
                  throws ParameterException
parameterize in interface ParameterizableParameterException
public void start()
           throws Exception
start in interface StartableExceptionpublic void stop()
stop in interface Startablepublic void run()
run in interface Runnableprotected void checkMemory()
protected long memoryInUse()
public void register(Store store)
register in interface StoreJanitorstore - the store to be registeredpublic void unregister(Store store)
unregister in interface StoreJanitorstore - the store to be unregisteredpublic Iterator iterator()
iterator in interface StoreJanitor| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||