You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2006/08/27 09:40:14 UTC

svn commit: r437320 - in /cocoon/branches/BRANCH_2_1_X: ./ legal/ lib/ lib/core/ src/java/org/apache/cocoon/components/store/impl/

Author: antonio
Date: Sun Aug 27 00:40:13 2006
New Revision: 437320

URL: http://svn.apache.org/viewvc?rev=437320&view=rev
Log:

<action dev="AG" type="update">
  Updated ehcache to 1.2.2.
</action>

Added:
    cocoon/branches/BRANCH_2_1_X/legal/ehcache-1.2.2.jar.license.txt
      - copied unchanged from r437299, cocoon/branches/BRANCH_2_1_X/legal/ehcache-1.2.jar.license.txt
    cocoon/branches/BRANCH_2_1_X/lib/core/ehcache-1.2.2.jar   (with props)
Removed:
    cocoon/branches/BRANCH_2_1_X/legal/ehcache-1.2.jar.license.txt
    cocoon/branches/BRANCH_2_1_X/lib/core/ehcache-1.2.jar
Modified:
    cocoon/branches/BRANCH_2_1_X/lib/jars.xml
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Added: cocoon/branches/BRANCH_2_1_X/lib/core/ehcache-1.2.2.jar
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/lib/core/ehcache-1.2.2.jar?rev=437320&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cocoon/branches/BRANCH_2_1_X/lib/core/ehcache-1.2.2.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: cocoon/branches/BRANCH_2_1_X/lib/jars.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/lib/jars.xml?rev=437320&r1=437319&r2=437320&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/lib/jars.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/lib/jars.xml Sun Aug 27 00:40:13 2006
@@ -504,7 +504,7 @@
     <title>EHCache</title>
     <description>Easy Hibernate Cache</description>
     <used-by>EHCache Store</used-by>
-    <lib>core/ehcache-1.2.jar</lib>
+    <lib>core/ehcache-1.2.2.jar</lib>
     <homepage>http://ehcache.sourceforge.net/</homepage>
   </file>
 

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java?rev=437320&r1=437319&r2=437320&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java Sun Aug 27 00:40:13 2006
@@ -29,6 +29,7 @@
 import net.sf.ehcache.CacheManager;
 import net.sf.ehcache.Element;
 import net.sf.ehcache.Status;
+import net.sf.ehcache.store.MemoryStoreEvictionPolicy;
 
 import org.apache.cocoon.Constants;
 import org.apache.cocoon.util.IOUtils;
@@ -86,6 +87,7 @@
 
     private File workDir;
     private File cacheDir;
+    private String diskStorePath;  // The directory to be used a disk store path. Uses java.io.tmpdir if the argument is null.
 
     // ---------------------------------------------------- Lifecycle
 
@@ -113,7 +115,7 @@
     /**
      * Configure the store. The following options can be used:
      * <ul>
-     *  <li><code>maxobjects</code> (10000) - The maximum number of in-memory objects.</li>
+     *  <li><code>maxobjects</code> (10000) - The maximum number of objects in memory.</li>
      *  <li><code>overflow-to-disk</code> (true) - Whether to spool elements to disk after
      *   maxobjects has been exceeded.</li>
      * <li><code>eternal</code> (true) - whether or not entries expire. When set to
@@ -220,27 +222,28 @@
      */
     private void setDirectory(final File directory) throws IOException  {
         
-        /* Save directory path prefix */
+        // Save directory path prefix
         String directoryPath = getFullFilename(directory);
         directoryPath += File.separator;
 
-        /* If directory doesn't exist, create it anew */
+        // If directory doesn't exist, create it anew
         if (!directory.exists()) {
             if (!directory.mkdir()) {
                 throw new IOException("Error creating store directory '" + directoryPath + "': ");
             }
         }
 
-        /* Is given file actually a directory? */
+        // Is given file actually a directory?
         if (!directory.isDirectory()) {
             throw new IOException("'" + directoryPath + "' is not a directory");
         }
 
-        /* Is directory readable and writable? */
+        // Is directory readable and writable?
         if (!(directory.canRead() && directory.canWrite())) {
             throw new IOException("Directory '" + directoryPath + "' is not readable/writable");
         }
-        System.setProperty("java.io.tmpdir", directoryPath);
+        this.diskStorePath = directoryPath;
+        //System.setProperty("java.io.tmpdir", directoryPath);
     }
 
     /**
@@ -267,8 +270,10 @@
     public void initialize() throws Exception {
         URL configFileURL = Thread.currentThread().getContextClassLoader().getResource(CONFIG_FILE);
         this.cacheManager = CacheManager.create(configFileURL);
-        this.cache = new Cache(this.cacheName, this.maxObjects, this.overflowToDisk, this.eternal,
-                this.timeToLiveSeconds, this.timeToIdleSeconds, this.diskPersistent, 120);
+        this.cache = new Cache(this.cacheName, this.maxObjects, MemoryStoreEvictionPolicy.LRU,
+                this.overflowToDisk, this.diskStorePath, this.eternal, this.timeToLiveSeconds,
+                this.timeToIdleSeconds, this.diskPersistent, Cache.DEFAULT_EXPIRY_THREAD_INTERVAL_SECONDS,
+                null, null);
         this.cacheManager.addCache(this.cache);
         this.storeJanitor.register(this);
         getLogger().info("EHCache cache \"" + this.cacheName + "\" initialized");
@@ -402,7 +407,7 @@
         }
         try {
             this.cache.removeAll();
-        } catch (IOException e) {
+        } catch (IllegalStateException e) {
             getLogger().error("Failure to clearing store", e);
         }
     }

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?rev=437320&r1=437319&r2=437320&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Sun Aug 27 00:40:13 2006
@@ -184,6 +184,9 @@
   <release version="@version@" date="@date@">
 -->
   <release version="2.1.10" date="TBD">
+    <action dev="AG" type="update">
+      Updated ehcache to 1.2.2.
+    </action>
     <action dev="AN" type="add">
       XSP block: Add example for on-the-fly generation of ZIP file.
     </action>