org.apache.excalibur.store.impl
Class StoreJanitorImpl

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLogEnabled
        |
        +--org.apache.excalibur.store.impl.StoreJanitorImpl
All Implemented Interfaces:
Component, LogEnabled, Parameterizable, Runnable, Startable, StoreJanitor, ThreadSafe

public class StoreJanitorImpl
extends AbstractLogEnabled
implements StoreJanitor, Parameterizable, ThreadSafe, Runnable, Startable

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.

Version:
CVS $Id: StoreJanitorImpl.java,v 1.4 2004/02/28 11:47:31 cziegeler Exp $
Author:
Avalon Development Team
Implements service:
type=StoreJanitor
Avalon component

Field Summary
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
 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.
 void parameterize(Parameters params)
          Initialize the StoreJanitorImpl.
 void register(Store store)
          This method register the stores
 void run()
          The "checker" thread checks if memory is running low in the jvm.
 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

invokeGC

protected boolean invokeGC
Should the gc be called on low memory?

Constructor Detail

StoreJanitorImpl

public StoreJanitorImpl()
Method Detail

parameterize

public void parameterize(Parameters params)
                  throws ParameterException
Initialize the StoreJanitorImpl. A few options can be used :

Specified by:
parameterize in interface Parameterizable
Parameters:
params - the Configuration of the application
Throws:
ParameterException

start

public void start()
Specified by:
start in interface Startable

stop

public void stop()
Specified by:
stop in interface Startable

run

public void run()
The "checker" thread checks if memory is running low in the jvm.

Specified by:
run in interface Runnable

register

public void register(Store store)
This method register the stores

Specified by:
register in interface StoreJanitor
Parameters:
store - the store to be registered

unregister

public void unregister(Store store)
This method unregister the stores

Specified by:
unregister in interface StoreJanitor
Parameters:
store - the store to be unregistered

iterator

public 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. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future.

Specified by:
iterator in interface StoreJanitor
Returns:
a java.util.Iterator


Copyright © 1997-2004 The Apache Software Foundation. All Rights Reserved.