|
|||||||||||
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.excalibur.store.impl.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 |
interval
The calculated delay for the next checker run in ms |
protected long |
inUse
Amount of memory in use before sleep(). |
protected boolean |
invokeGC
Should 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. |
java.util.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(org.apache.avalon.framework.parameters.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(org.apache.avalon.framework.parameters.Parameters params) throws org.apache.avalon.framework.parameters.ParameterException
parameterize
in interface org.apache.avalon.framework.parameters.Parameterizable
params
- the Configuration of the application
org.apache.avalon.framework.parameters.ParameterException
public void start()
start
in interface org.apache.avalon.framework.activity.Startable
public void stop()
stop
in interface org.apache.avalon.framework.activity.Startable
public void run()
run
in interface java.lang.Runnable
protected void checkMemory()
protected long memoryInUse()
public void register(Store store)
register
in interface StoreJanitor
store
- the store to be registeredpublic void unregister(Store store)
unregister
in interface StoreJanitor
store
- the store to be unregisteredpublic java.util.Iterator iterator()
iterator
in interface StoreJanitor
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |