dims 01/05/01 14:32:59
Modified: src/org/apache/cocoon/components/store Tag: xml-cocoon2
MRUMemoryStore.java
webapp Tag: xml-cocoon2 cocoon.xconf
Log:
Patch from "gerhard" <[EMAIL PROTECTED]> for MRUMemoryStore
Revision Changes Path
No revision
No revision
1.1.2.5 +9 -10
xml-cocoon/src/org/apache/cocoon/components/store/Attic/MRUMemoryStore.java
Index: MRUMemoryStore.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/store/Attic/MRUMemoryStore.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- MRUMemoryStore.java 2001/04/30 14:17:16 1.1.2.4
+++ MRUMemoryStore.java 2001/05/01 21:32:58 1.1.2.5
@@ -9,13 +9,12 @@
import java.util.Enumeration;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.LinkedList;
-import java.util.Map;
import org.apache.avalon.framework.component.Component;
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;
@@ -36,7 +35,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
*/
-public class MRUMemoryStore implements Store, Configurable, ThreadSafe,
Runnable {
+public class MRUMemoryStore extends AbstractLoggable implements Store,
Configurable, ThreadSafe, Runnable {
/**
* Indicates how much memory should be left free in the JVM for
* normal operation.
@@ -73,8 +72,7 @@
* Indicates the max. object in the cache
*/
private int maxobjects;
-
-
+
/**
* The heart of the cache
*/
@@ -161,13 +159,14 @@
* create the MRU.
*/
public void hold(Object key, Object value) {
+ getLogger().debug("Holding object in memory. Key: " + key);
/** ...first test if the max. objects in cache is reached... */
if(this.mrulist.size() >= this.maxobjects) {
/** ...ok, heapsize is reached, remove the last element... */
this.free();
}
/** ..put the new object in the cache, on the top of course ... */
- this.cache.put(key, new CacheObject(value,System.currentTimeMillis()));
+ this.cache.put(key, new
CacheObject(value,System.currentTimeMillis()));
this.mrulist.addFirst(key);
}
@@ -223,7 +222,7 @@
this.cache.remove(this.mrulist.getLast());
this.mrulist.removeLast();
}
-
+
/**
* Container object for the documents.
*/
@@ -237,11 +236,11 @@
}
public Object getCacheObject() {
- return cacheObject;
+ return this.cacheObject;
}
public long getCreateTime() {
- return time;
+ return this.time;
}
}
-}
+}
\ No newline at end of file
No revision
No revision
1.1.2.45 +15 -0 xml-cocoon/webapp/Attic/cocoon.xconf
Index: cocoon.xconf
===================================================================
RCS file: /home/cvs/xml-cocoon/webapp/Attic/cocoon.xconf,v
retrieving revision 1.1.2.44
retrieving revision 1.1.2.45
diff -u -r1.1.2.44 -r1.1.2.45
--- cocoon.xconf 2001/05/01 19:09:26 1.1.2.44
+++ cocoon.xconf 2001/05/01 21:32:59 1.1.2.45
@@ -3,6 +3,21 @@
<!-- ===================== General Components =========================== -->
+ <!-- Caching:
+ 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.
+ objectlifetime: Indicates how long (seconds) a cache object will
+ be hold in memory. The object will be thrown out,
+ when the time is over.
+ interval: 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.
+ usethread: Indicates whether we use a cleanup thread or not.
+ threadpriority: Indicates the priority of the cleanup thread.
+ -->
<store class="org.apache.cocoon.components.store.MRUMemoryStore">
<parameter name="freememory" value="1000000"/>
<parameter name="heapsize" value="60000000"/>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]