cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-cocoon2/webapp cocoon.xconf
Date Wed, 05 Sep 2001 11:56:27 GMT
dims        01/09/05 04:56:27

  Modified:    src/org/apache/cocoon cocoon.roles
               src/org/apache/cocoon/components/store FilesystemStore.java
                        MRUMemoryStore.java MemoryStore.java Store.java
               webapp   cocoon.xconf
  Added:       src/org/apache/cocoon/components/store StoreJanitor.java
                        StoreJanitorImpl.java
  Log:
  Patch for a new StoreJanitor Component from "Gerhard Froehlich" <g-froehlich@gmx.de>
  
  Revision  Changes    Path
  1.20      +4 -0      xml-cocoon2/src/org/apache/cocoon/cocoon.roles
  
  Index: cocoon.roles
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/cocoon.roles,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- cocoon.roles	2001/08/20 12:36:59	1.19
  +++ cocoon.roles	2001/09/05 11:56:26	1.20
  @@ -91,6 +91,10 @@
    <role name="org.apache.cocoon.components.store.Store/StreamCache"
          shorthand="stream-cache"
          default-class="org.apache.cocoon.components.store.MRUMemoryStore"/>
  + 
  + <role name="org.apache.cocoon.components.store.StoreJanitor"
  +       shorthand="store-janitor"
  +       default-class="org.apache.cocoon.components.store.StoreJanitorImpl"/>
   
    <role name="org.apache.cocoon.components.profiler.Profiler"
          shorthand="profiler"
  
  
  
  1.5       +2 -0      xml-cocoon2/src/org/apache/cocoon/components/store/FilesystemStore.java
  
  Index: FilesystemStore.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/store/FilesystemStore.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FilesystemStore.java	2001/08/20 13:55:13	1.4
  +++ FilesystemStore.java	2001/09/05 11:56:26	1.5
  @@ -180,6 +180,8 @@
       return null;
     }
   
  +  public void free() {}  
  +
     public Object getObject(Object key)
       throws IOException, ClassNotFoundException
     {
  
  
  
  1.18      +35 -133   xml-cocoon2/src/org/apache/cocoon/components/store/MRUMemoryStore.java
  
  Index: MRUMemoryStore.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/store/MRUMemoryStore.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- MRUMemoryStore.java	2001/08/28 13:31:46	1.17
  +++ MRUMemoryStore.java	2001/09/05 11:56:26	1.18
  @@ -48,29 +48,8 @@
   public class MRUMemoryStore extends AbstractLoggable implements Store, Configurable, 
                                                                   ThreadSafe, Runnable, 
                                                                   Composable, Contextualizable
{
  + 
     /**
  -   * Indicates how much memory should be left free in the JVM for
  -   * normal operation.
  -   */
  -  private int freememory;
  -
  -  /**
  -   * Indicates how big the heap size can grow to before the cleanup thread kicks in.
  -   * The default value is based on the default maximum heap size of 64Mb.
  -   */
  -  private int heapsize;
  -
  -  /**
  -   * Indicates the time in seconds to sleep between memory checks.
  -   */
  -  private long cleanupthreadinterval;
  -
  -  /**
  -   * Indicates whether we use a cleanup thread or not.
  -   */
  -  private boolean usecleanupthread;
  -
  -  /**
      * Indicates the daemon thread priority.
      */
     private int priority;
  @@ -98,6 +77,7 @@
      */
     private File cachefile;
     private Store fsstore;
  +  private StoreJanitor storejanitor;
     private Stack writerstack;
     private Thread writer;
     private File cachedir;
  @@ -115,6 +95,8 @@
         this.manager = manager;
         getLogger().debug("Looking up " + Store.ROLE + "/Filesystem");
         this.fsstore = (Store)manager.lookup(Store.ROLE + "/Filesystem");
  +      getLogger().debug("Looking up " + StoreJanitor.ROLE);
  +      this.storejanitor = (StoreJanitor)manager.lookup(StoreJanitor.ROLE);
       } catch(ComponentException e) {
         getLogger().error("Error in compose()!", e);
       }
  @@ -144,24 +126,19 @@
      * Initialize the MRUMemoryStore.
      * A few options can be used :
      * <UL>
  -   *  <LI>freememory = How much memory to keep free for normal jvm operation. (Default:
1 Mb)</LI>
  -   *  <LI>heapsize = The size of the heap before cleanup starts. (Default: 60 Mb)</LI>
  -   *  <LI>cleanupthreadinterval = time in seconds to sleep between memory checks
(Default: 10 seconds)</LI>
      *  <LI>maxobjects = how many objects will be stored in memory (Default: 10o objects)</LI>
      *  <LI>threadpriority = priority of the thread (1-10). (Default: 10)</LI>
      *  <LI>filesystem = use filesystem storage to keep object persistent (Default:
false)</LI>
  -   *  <LI>usecleanupthread = use a cleanup daemon thread. (Default: true)</LI>
    
      * </UL>
      */
     public void configure(Configuration conf) throws ConfigurationException {
       this.jvm         = Runtime.getRuntime();
       this.mrulist     = new LinkedList();
       this.writerstack = new Stack();
  +
  +    this.storejanitor.register(this);
     
       Parameters params = Parameters.fromConfiguration(conf);
  -    this.freememory            = params.getParameterAsInteger("freememory",1000000);
  -    this.heapsize              = params.getParameterAsInteger("heapsize",60000000);
  -    this.cleanupthreadinterval = params.getParameterAsInteger("cleanupthreadinterval",10);
       this.maxobjects            = params.getParameterAsInteger("maxobjects",100);
       this.cache                 = new HashMap((int)(this.maxobjects * 1.2));
       this.priority              = params.getParameterAsInteger("threadpriority",Thread.currentThread().getPriority());
  @@ -172,21 +149,7 @@
       if ((this.maxobjects < 1)) {
         throw new ConfigurationException("MRUMemoryStore maxobjects must be at least 1 milli
second!");
       }
  -    if ((this.cleanupthreadinterval < 1)) {
  -      throw new ConfigurationException("MRUMemoryStore cleanup thread interval must be
at least 1 second!");
  -    }
   
  -    this.usecleanupthread = params.getParameter("usecleanupthread","true").equals("true");
  -    
  -    if (this.usecleanupthread) {
  -      getLogger().debug("Intializing checker thread");
  -      Thread checker = new Thread(this);
  -      checker.setPriority(this.priority);
  -      checker.setDaemon(true);
  -      checker.setName("checker");
  -      checker.start();
  -    }
  -  
       if (this.filesystem) {
         getLogger().debug("Intializing writer thread");
         writer = new Thread(this);
  @@ -204,62 +167,28 @@
      * Thread writer writes objects from the writer stack onto the filesystem.
      */
     public void run() {
  -    if(Thread.currentThread().getName().equals("checker")) {
  -      while (true) {
  -        // amount of memory used is greater then heapsize
  -        if (memoryLow()) {
  -          getLogger().debug("Invoking garbage collection, total memory = "
  -              + this.jvm.totalMemory() + ", free memory = " 
  -              + this.jvm.freeMemory());
  -          this.jvm.runFinalization();
  -          this.jvm.gc();
  -          getLogger().debug("Garbage collection complete, total memory = "
  -              + this.jvm.totalMemory() + ", free memory = "
  -              + this.jvm.freeMemory());
  -          getLogger().debug("Store size BEFORE cleanup=" + this.cache.size());
  -          synchronized (this) {
  -            while ((this.cache.size() > 0) && memoryLow()) {
  -              this.free();
  -            }
  -          }
  -          getLogger().debug("Store size AFTER cleanup=" + this.cache.size());
  -        }
  -
  +    while (true) {
  +      getLogger().debug("Writerthread awake!");
  +      while(!writerstack.empty()) {
           try {
  -          Thread.currentThread().sleep(this.cleanupthreadinterval * 1000);
  -        } catch (InterruptedException ignore) {}
  -      }
  -    } else if(Thread.currentThread().getName().equals("writer")) {
  -      while (true) {
  -        getLogger().debug("Writerthread awake!");
  -        while(!writerstack.empty()) {
  -          try {
  -            TmpStackObject tmp = (TmpStackObject)this.writerstack.pop();
  -            this.fsstore.store(getFileName(tmp.getKey().toString()), tmp.getObject());
  -          } catch(IOException e) {  
  -            getLogger().error("Error in writer thread",e);
  -          } catch(Exception ex) {
  -            getLogger().error("Error in writer thread",ex);
  -          }
  +          TmpStackObject tmp = (TmpStackObject)this.writerstack.pop();
  +          this.fsstore.store(getFileName(tmp.getKey().toString()), tmp.getObject());
  +        } catch(IOException e) {  
  +          getLogger().error("Error in writer thread",e);
  +        } catch(Exception ex) {
  +          getLogger().error("Error in writer thread",ex);
           }
  +      }
   
  -        synchronized (this.writer) {
  -          try {
  -            writer.wait();
  -          } catch (InterruptedException ignored) {}
  -        }
  +      synchronized (this.writer) {
  +        try {
  +          writer.wait();
  +        } catch (InterruptedException ignored) {}
         }
       }
     }
  -  
  + 
     /**
  -   * Method to check if memory is running low in the jvm.
  -   */
  -  private boolean memoryLow() {
  -    return jvm.totalMemory() > heapsize && jvm.freeMemory() < freememory;
  -  }
  -
  -  /**
      * Store the given object in a persistent state. It is up to the
      * caller to ensure that the key has a persistent state across
      * different JVM executions.
  @@ -298,6 +227,7 @@
       this.cache.put(key, value);
       this.mrulist.remove(key);
       this.mrulist.addFirst(key);
  +    getLogger().debug("Cache size=" + cache.size());
     }
   
     /**
  @@ -336,7 +266,6 @@
           }
         }
       }
  -
       return null;
     }
   
  @@ -376,10 +305,12 @@
      */
     public void free() {
       try {
  -      this.cache.remove(this.mrulist.getLast());
  -      this.mrulist.removeLast();
  -      this.jvm.runFinalization();
  -      this.jvm.gc();
  +      if(this.cache.size() > 0) {
  +        this.getLogger().debug("Freeing cache");
  +        this.cache.remove(this.mrulist.getLast());
  +        this.mrulist.removeLast();
  +        getLogger().debug("Cache size=" + cache.size());
  +      }
       } catch (Exception e) {
         getLogger().error("Error in free()", e);
       }
  @@ -405,44 +336,15 @@
         return false;
       }
     }
  -
  -    private String getFileName(String key)
  -    {
  -        return new StringBuffer()
  -            .append(this.cachedirstr)
  -            .append(File.separator)
  -//            .append(HashUtil.hash(key.toString()) & 0x1F)
  -//            .append(File.separator)
  -            .append(URLEncoder.encode(key.toString()))
  -            .toString();
  -    }
   
  -  /**
  -   * Container object for the documents.
  -  class CacheObject {
  -    private long time = -1;
  -    private Object cacheObject;
  -    private boolean serialised;
  -
  -    public CacheObject(Object ToCacheObject, long lTime, boolean serialised) {
  -      this.cacheObject = ToCacheObject;
  -      this.time = lTime;
  -      this.serialised = serialised;
  -    }
  -
  -    public Object getCacheObject() {
  -      return this.cacheObject;
  -    }
  -
  -    public long getCreateTime() {
  -      return this.time;
  -    }
  -
  -    public boolean getSerialisedFlag() {
  -      return this.serialised;
  -    }
  +  private String getFileName(String key)
  +  {
  +      return new StringBuffer()
  +          .append(this.cachedirstr)
  +          .append(File.separator)
  +          .append(URLEncoder.encode(key.toString()))
  +          .toString();
     }
  -   */
   
     /**
      * Temporary container object for the writerstack
  
  
  
  1.3       +3 -1      xml-cocoon2/src/org/apache/cocoon/components/store/MemoryStore.java
  
  Index: MemoryStore.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/store/MemoryStore.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MemoryStore.java	2001/08/20 13:55:13	1.2
  +++ MemoryStore.java	2001/09/05 11:56:26	1.3
  @@ -20,7 +20,7 @@
    *         (Apache Software Foundation)
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.2 $ $Date: 2001/08/20 13:55:13 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/09/05 11:56:26 $
    */
   public class MemoryStore implements Store, ThreadSafe {
       /* WARNING: Hashtable is threadsafe, whereas HashMap is not.
  @@ -67,6 +67,8 @@
       public void remove(Object key) {
           table.remove(key);
       }
  +
  +    public void free() {}
   
       /**
        * Indicates if the given key is associated to a contained object.
  
  
  
  1.4       +3 -1      xml-cocoon2/src/org/apache/cocoon/components/store/Store.java
  
  Index: Store.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/store/Store.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Store.java	2001/08/20 13:55:13	1.3
  +++ Store.java	2001/09/05 11:56:26	1.4
  @@ -20,7 +20,7 @@
    *         (Apache Software Foundation)
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.3 $ $Date: 2001/08/20 13:55:13 $
  + * @version CVS $Revision: 1.4 $ $Date: 2001/09/05 11:56:26 $
    */
   public interface Store extends Component {
   
  @@ -44,6 +44,8 @@
        * virtual machine is restarted or some error happens.
        */
       void hold(Object key, Object value) throws IOException;
  +
  +    void free();
   
       /**
        * Remove the object associated to the given key.
  
  
  
  1.1                  xml-cocoon2/src/org/apache/cocoon/components/store/StoreJanitor.java
  
  Index: StoreJanitor.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included  with this distribution in *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  package org.apache.cocoon.components.store;
  
  import org.apache.avalon.framework.component.Component;
  
  /**
   * Interface for the StoreJanitors
   *
   * @author <a href="mailto:g-froehlich@gmx.de">Gerhard Froehlich</a>
   */
  public interface StoreJanitor extends Component {
  
    String ROLE = "org.apache.cocoon.components.store.StoreJanitor";
  
    /** register method for the stores */
    public void register(Store store);
  
    /** unregister method for the stores */
    public void unregister(Store store);
  }
  
  
  1.1                  xml-cocoon2/src/org/apache/cocoon/components/store/StoreJanitorImpl.java
  
  Index: StoreJanitorImpl.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included  with this distribution in *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  package org.apache.cocoon.components.store;
  
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.logger.AbstractLoggable;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.avalon.framework.thread.ThreadSafe;
  import org.apache.cocoon.Constants;
  
  import java.util.Collections;
  import java.util.ArrayList;
  
  /**
   * 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. 
   *
   * @author <a href="mailto:cs@ffzj0ia9.bank.dresdner.net">Christian Schmitt</a>
   * @author <a href="mailto:g-froehlich@gmx.de">Gerhard Froehlich</a>
   * @author <a href="mailto:proyal@managingpartners.com">Peter Royal</a>
   */
  public class StoreJanitorImpl extends AbstractLoggable implements StoreJanitor,
                                                                    Configurable, 
                                                                    ThreadSafe, 
                                                                    Runnable {
  
    private int freememory = -1;
    private int heapsize = -1;
    private int cleanupthreadinterval = -1;
    private int priority = -1;
    private Runtime jvm;
    private ArrayList storelist;
    private int index = -1;
  
  
    /** 
     * Initialize the StoreJanitorImpl.
     * A few options can be used :
     * <UL>
     *  <LI>freememory = how many bytes shall be always free in the jvm</LI>
     *  <LI>heapsize = max. size of jvm memory consumption</LI>
     *  <LI>cleanupthreadinterval = how often (sec) shall run the cleanup thread</LI>
     *  <LI>threadpriority = priority of the thread (1-10). (Default: 10)</LI>
     * </UL>
     */
    public void configure(Configuration conf) throws ConfigurationException {
      this.getLogger().debug("Configure StoreJanitorImpl");
      this.setJVM(Runtime.getRuntime());
  
      Parameters params = Parameters.fromConfiguration(conf);
      this.setFreememory(params.getParameterAsInteger("freememory",1000000));
      this.setHeapsize(params.getParameterAsInteger("heapsize",60000000));
      this.setCleanupthreadinterval(params.getParameterAsInteger("cleanupthreadinterval",10));
      this.setPriority(params.getParameterAsInteger("threadpriority",Thread.currentThread().getPriority()));
  
      this.setStoreList(new ArrayList());
  
      Thread checker = new Thread(this);
      this.getLogger().debug("Intializing checker thread");
      checker.setPriority(this.getPriority());
      checker.setDaemon(true);
      checker.setName("checker");
      checker.start();
    }
  
    public void run() {
      while (true) {
        // amount of memory used is greater then heapsize
        if (this.memoryLow()) {
          this.getLogger().debug("Invoking garbage collection, total memory = "
              + this.getJVM().totalMemory() + ", free memory = " 
              + this.getJVM().freeMemory());
          this.freePhysicalMemory();
          this.getLogger().debug("Garbage collection complete, total memory = "
              + this.getJVM().totalMemory() + ", free memory = "
              + this.getJVM().freeMemory());
          synchronized (this) {
            while (this.memoryLow() && this.getStoreList().size() > 0) {
              this.freeMemory();
            }
            this.resetIndex();
          }
        }
        try {
          Thread.currentThread().sleep(this.cleanupthreadinterval * 1000);
        } catch (InterruptedException ignore) {}
      }
    }
  
    /**
     * Method to check if memory is running low in the getJVM().
     */
    private boolean memoryLow() {
      this.getLogger().debug("getJVM().totalMemory()=" + this.getJVM().totalMemory());
      this.getLogger().debug("getHeapsize()=" + this.getHeapsize());
      this.getLogger().debug("getJVM().freeMemory()=" + this.getJVM().freeMemory());
      this.getLogger().debug("getFreememory()=" + this.getFreememory());
      return this.getJVM().totalMemory() > this.getHeapsize() && this.getJVM().freeMemory()
< this.getFreememory();
    }
  
    /**
     * This method register the store in the StoreJanitor
     */
    public void register(Store store) {
      this.getLogger().debug("Registering store instance");
      this.getStoreList().add(store);
      this.getLogger().debug("Size of StoreJanitor now:" + this.getStoreList().size());
    }
  
    /**
     * This method unregister the store in the StoreJanitor
     */
    public void unregister(Store store) {
      this.getLogger().debug("Unregister store instance");
      this.getStoreList().remove(store);
      this.getLogger().debug("Size of StoreJanitor now:" + this.getStoreList().size());
    }
  
    /**
     * Round Robin alghorithm for freeing the registerd caches.
     */
    private void freeMemory() {
      try {
        this.getLogger().debug("StoreJanitor freeing memory!");
        this.getLogger().debug("StoreList size=" + this.getStoreList().size());
        this.getLogger().debug("Index before=" + this.getIndex());
        if (this.getIndex() < this.getStoreList().size()) {
          if(this.getIndex() == -1) {
            this.getLogger().debug("Freeing at index=" + this.getIndex());
            ((Store)this.getStoreList().get(0)).free();
            this.setIndex(0);
          } else {
            this.getLogger().debug("Freeing at index=" + this.getIndex());
            ((Store)this.getStoreList().get(this.getIndex())).free();
            this.setIndex(this.getIndex() + 1);
          }
        } else {
          this.getLogger().debug("Starting from the beginning");
          this.resetIndex();
          ((Store)this.getStoreList().get(0)).free();
          this.setIndex(0);
        }
        this.freePhysicalMemory();
        this.getLogger().debug("Index after=" + this.getIndex());
      } catch(Exception e) {
        this.getLogger().error("Error in freeMemory()",e);
      }
    }
  
    /**
     * This method forces the garbage collector
     */
    private void freePhysicalMemory() {
      this.getJVM().runFinalization();
      this.getJVM().gc();
    }
  
    /** 
     * Getter and setter methods
     */
    private int getFreememory() {
      return freememory;
    }
  
    private void setFreememory(int _freememory) {
      this.freememory = _freememory;
    }
  
    private int getHeapsize() {
      return this.heapsize;
    }
  
    private void setHeapsize(int _heapsize) {
      this.heapsize = _heapsize;
    } 
  
    private int getCleanupthreadinterval() {
      return this.cleanupthreadinterval;
    }
  
    private void setCleanupthreadinterval(int _cleanupthreadinterval) {
      this.cleanupthreadinterval = _cleanupthreadinterval;
    }
  
    private int getPriority() {
      return this.priority;
    }
  
    private void setPriority(int _priority) {
      this.priority = _priority;
    }
  
    private Runtime getJVM() {
      return this.jvm;
    }
  
    private void setJVM(Runtime _runtime) {
      this.jvm = _runtime;
    }
  
    private ArrayList getStoreList() {
      return this.storelist;
    }
  
    private void setStoreList(ArrayList _storelist) {
      this.storelist = _storelist;
    }
  
    private void setIndex(int _index) {
      this.getLogger().debug("Setting index=" + _index);
      this.index = _index;
    }
  
    private int getIndex() {
      return this.index;
    }
  
    private void resetIndex() {
      this.getLogger().debug("Reseting index");
      this.index = -1;
    }
  }
  
  
  1.31      +26 -25    xml-cocoon2/webapp/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/webapp/cocoon.xconf,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- cocoon.xconf	2001/08/30 19:15:44	1.30
  +++ cocoon.xconf	2001/09/05 11:56:27	1.31
  @@ -19,29 +19,44 @@
     -->
   
     <!-- Storing:
  -       freememory: Indicates how much memory should be left free in the
  -                   JVM for normal operation.
  -       heapsize: Indicates how big the heap size can grow to before the
  -                 cleanup thread kicks in.
  -       cleanupthreadinterval: Indicates the interval of the cleanup thread in seconds.
          maxobjects: Indicates how many objects will be hold in the cache.
                      When the number of maxobjects has been reached. The
                      last object in the cache will be thrown out.
  -       usecleanupthread: Indicates whether we use a cleanup thread or not.
  -       threadpriority: Indicates the priority of the cleanup thread.
  +       threadpriority: Indicates the priority of the writer thread.
                          (1 is the lowest priority and 10 is the highest).
          filesystem: Turns the filesystem storage for objects on or off.
     -->
     <store class="org.apache.cocoon.components.store.MRUMemoryStore" logger="root.store">
  -     <parameter name="freememory" value="1000000"/>
  -     <parameter name="heapsize" value="60000000"/>
  -     <parameter name="cleanupthreadinterval" value="10"/>
        <parameter name="maxobjects" value="100"/>
  -     <parameter name="usecleanupthread" value="true"/>
        <parameter name="threadpriority" value="5"/>
        <parameter name="filesystem" value="true"/>
     </store>
   
  +  <!-- Store Janitor:
  +    freememory = How much free memory shall be available in the jvm
  +    heapsize = Indicates the limit of the jvm memory consumption
  +    cleanupthreadinterval = How often shall the cleanup thread check memory
  +    threadpriority = Indicates the thread priority of the cleanup thread
  +
  +    Be carefull with the heapsize and freememory paramters. Wrong values can
  +    cause high cpu usage.
  +    Example configuration:
  +    Jvm settings: 
  +      -Xms100000000 -Xmx200000000
  +    store-janitor settings:
  +       <parameter name="freememory" value="50000000"/>
  +       <parameter name="heapsize" value="150000000"/>
  +  
  +    Heapsize must be higher then the -Xms parameter and freememory
  +    between those both.    
  +  -->
  +  <store-janitor class="org.apache.cocoon.components.store.StoreJanitorImpl" logger="root.store">
  +     <parameter name="freememory" value="1000000"/>
  +     <parameter name="heapsize" value="60000000"/>
  +     <parameter name="cleanupthreadinterval" value="10"/>
  +     <parameter name="threadpriority" value="5"/>
  +  </store-janitor>
  +
     <xslt-processor class="org.apache.cocoon.components.xslt.XSLTProcessorImpl" logger="root.xslt">
        <parameter name="use-store" value="true"/>
     </xslt-processor>
  @@ -262,11 +277,7 @@
          filesystem: Turns the filesystem storage for objects on or off.
     -->
     <stream-cache class="org.apache.cocoon.components.store.MRUMemoryStore" logger="root.store">
  -     <parameter name="freememory" value="1000000"/>
  -     <parameter name="heapsize" value="60000000"/>
  -     <parameter name="cleanupthreadinterval" value="10"/>
        <parameter name="maxobjects" value="100"/>
  -     <parameter name="usecleanupthread" value="true"/>
        <parameter name="threadpriority" value="5"/>
        <parameter name="filesystem" value="true"/>
     </stream-cache>
  @@ -283,25 +294,15 @@
                     pool-max="32" pool-min="16" pool-grow="4"/>
   
     <!-- Caching of event pipeline:
  -       freememory: Indicates how much memory should be left free in the
  -                   JVM for normal operation.
  -       heapsize: Indicates how big the heap size can grow to before the
  -                 cleanup thread kicks in.
  -       cleanupthreadinterval: Indicates the interval of the cleanup thread in seconds.
          maxobjects: Indicates how many objects will be hold in the cache.
                      When the number of maxobjects has been reached. The
                      last object in the cache will be thrown out.
  -       usecleanupthread: Indicates whether we use a cleanup thread or not.
          threadpriority: Indicates the priority of the cleanup thread.
                          (1 is the lowest priority and 10 is the highest).
          filesystem: Turns the filesystem storage for objects on or off.
     -->
     <event-cache class="org.apache.cocoon.components.store.MRUMemoryStore" logger="root.store">
  -     <parameter name="freememory" value="1000000"/>
  -     <parameter name="heapsize" value="60000000"/>
  -     <parameter name="cleanupthreadinterval" value="10"/>
        <parameter name="maxobjects" value="100"/>
  -     <parameter name="usecleanupthread" value="true"/>
        <parameter name="threadpriority" value="5"/>
        <parameter name="filesystem" value="true"/>
     </event-cache>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message