org.apache.cocoon.components.store
Class StoreJanitorImpl

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.components.store.StoreJanitorImpl
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.Loggable, java.lang.Runnable, org.apache.avalon.framework.activity.Startable, StoreJanitor, org.apache.avalon.framework.thread.ThreadSafe

public class StoreJanitorImpl
extends org.apache.avalon.framework.logger.AbstractLoggable
implements StoreJanitor, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.thread.ThreadSafe, java.lang.Runnable, org.apache.avalon.framework.activity.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.11 2002/02/22 07:00:14 cziegeler Exp $
Author:
Christian Schmitt, Gerhard Froehlich, Peter Royal

Fields inherited from interface org.apache.cocoon.components.store.StoreJanitor
ROLE
 
Constructor Summary
StoreJanitorImpl()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
          Initialize the StoreJanitorImpl.
 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.
 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.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoreJanitorImpl

public StoreJanitorImpl()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Initialize the StoreJanitorImpl. A few options can be used :
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Parameters:
the - Configuration of the application
Throws:
org.apache.avalon.framework.configuration.ConfigurationException -  

start

public void start()
Specified by:
start in interface org.apache.avalon.framework.activity.Startable

stop

public void stop()
Specified by:
stop in interface org.apache.avalon.framework.activity.Startable

run

public void run()
The "checker" thread checks if memory is running low in the jvm.
Specified by:
run in interface java.lang.Runnable

register

public void register(Store store)
This method register the stores
Specified by:
register in interface StoreJanitor
Parameters:
the - store to be registered

unregister

public void unregister(Store store)
This method unregister the stores
Specified by:
unregister in interface StoreJanitor
Parameters:
the - store to be unregistered

iterator

public 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. 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 © 1999-2002 Apache Software Foundation. All Rights Reserved.