Antonio Gallardo wrote:

Hi Jann,

+1 See: http://svn.apache.org/viewvc?view=rev&revision=524487


thanks

Michi


Best Regards,

Antonio Gallardo.

Jann Forrer escribió:

Hi

We encounter problems with a LRUMap under heavy load in lenya-1.2. That
might be due to unsynchronized access to the map.

According to
http://jakarta.apache.org/commons/collections/api-3.1/org/apache/commons/collections/map/LRUMap.html a LRUMap should be synchronized if it will be accessed by multiple threads:

"A synchronized version can be obtained with:
Collections.synchronizedMap( theMapToSynchronize )  If it will be
accessed by multiple threads, you _must_ synchronize access to this Map.
Even concurrent get(Object) operations produce indeterminate behaviour."

Therefor I propose the following change in the URIParameterizerImpl.java:

Index:
org/apache/lenya/cms/cocoon/uriparameterizer/URIParameterizerImpl.java
===================================================================
---
org/apache/lenya/cms/cocoon/uriparameterizer/URIParameterizerImpl.java
    (revision 515604)
+++
org/apache/lenya/cms/cocoon/uriparameterizer/URIParameterizerImpl.java
    (working copy)
@@ -22,6 +22,7 @@

 import java.util.HashMap;
 import java.util.Map;
+import java.util.Collections;

 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.logger.Logger;
@@ -178,8 +179,9 @@

     protected static final int CACHE_CAPACITY = 1000;

-    private static Map cache = new LRUMap(CACHE_CAPACITY);
-
+      private static Map cache = Collections.synchronizedMap (new
LRUMap (CACHE_CAPACITY));
+
     private ServiceManager manager;

     /**

WDYT

Jann



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
[EMAIL PROTECTED]                        [EMAIL PROTECTED]
+41 44 272 91 61


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to