svn commit: r948328 - in /ofbiz/trunk: .classpath LICENSE framework/base/lib/clhm-20100316.jar framework/base/lib/clhm-release-1.0-lru.jar framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r948328 - in /ofbiz/trunk: .classpath LICENSE framework/base/lib/clhm-20100316.jar framework/base/lib/clhm-release-1.0-lru.jar framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

doogie-3
Author: doogie
Date: Wed May 26 05:52:11 2010
New Revision: 948328

URL: http://svn.apache.org/viewvc?rev=948328&view=rev
Log:
Revert "As suggested by Ben Manes at "Upgrade ConcurrentLinkedHashMap" (https://issues.apache.org/jira/browse/OFBIZ-3779) - OFBIZ-3779"

The new library does *not* function correctly.  It breaks the
testChangeMemSize test case.  Reducing the memory size *must* still obey
the LRU settings; the new library removes items at random.

Added:
    ofbiz/trunk/framework/base/lib/clhm-20100316.jar
Removed:
    ofbiz/trunk/framework/base/lib/clhm-release-1.0-lru.jar
Modified:
    ofbiz/trunk/.classpath
    ofbiz/trunk/LICENSE
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

Modified: ofbiz/trunk/.classpath
URL: http://svn.apache.org/viewvc/ofbiz/trunk/.classpath?rev=948328&r1=948327&r2=948328&view=diff
==============================================================================
--- ofbiz/trunk/.classpath (original)
+++ ofbiz/trunk/.classpath Wed May 26 05:52:11 2010
@@ -15,7 +15,7 @@
     <classpathentry kind="lib" path="framework/base/lib/avalon-util-exception-1.0.0.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/barcode4j-fop-ext-complete-2.0.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/batik-all-1.7.jar"/>
-    <classpathentry kind="lib" path="framework/base/lib/clhm-release-1.0-lru.jar"/>
+    <classpathentry kind="lib" path="framework/base/lib/clhm-20100316.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/hamcrest-all-1.2.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/fop-0.95.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/freemarker-2.3.15.jar"/>

Modified: ofbiz/trunk/LICENSE
URL: http://svn.apache.org/viewvc/ofbiz/trunk/LICENSE?rev=948328&r1=948327&r2=948328&view=diff
==============================================================================
--- ofbiz/trunk/LICENSE (original)
+++ ofbiz/trunk/LICENSE Wed May 26 05:52:11 2010
@@ -21,7 +21,7 @@ ofbiz/trunk/framework/base/lib/avalon-fr
 ofbiz/trunk/framework/base/lib/avalon-util-exception-1.0.0.jar
 ofbiz/trunk/framework/base/lib/batik-all-1.7.jar
 ofbiz/trunk/framework/base/lib/barcode4j-fop-ext-complete-2.0.jar
-ofbiz/trunk/framework/base/lib/clhm-release-1.0-lru.jar
+ofbiz/trunk/framework/base/lib/clhm-20100316.jar
 ofbiz/trunk/framework/base/lib/jakarta-regexp-1.5.jar
 ofbiz/trunk/framework/base/lib/jpim-0.1.jar
 ofbiz/trunk/framework/base/lib/juel-2.2.1.jar

Added: ofbiz/trunk/framework/base/lib/clhm-20100316.jar
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/clhm-20100316.jar?rev=948328&view=auto
==============================================================================
Files ofbiz/trunk/framework/base/lib/clhm-20100316.jar (added) and ofbiz/trunk/framework/base/lib/clhm-20100316.jar Wed May 26 05:52:11 2010 differ

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=948328&r1=948327&r2=948328&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java Wed May 26 05:52:11 2010
@@ -38,9 +38,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
-import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
-import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.Builder;
-import com.googlecode.concurrentlinkedhashmap.Weighers;
+import com.reardencommerce.kernel.collections.shared.evictable.ConcurrentLinkedHashMap;
 
 import javolution.util.FastList;
 import javolution.util.FastMap;
@@ -145,9 +143,7 @@ public class UtilCache<K, V> implements
         if (maxMemSize == 0) {
             memoryTable = new ConcurrentHashMap<Object, CacheLine<V>>();
         } else {
-            memoryTable = new Builder<Object, CacheLine<V>>()
-            .maximumWeightedCapacity(maxMemSize)
-            .build();
+            memoryTable = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.LRU, maxMemSize);
         }
         if (this.useFileSystemStore) {
             // create the manager the first time it is needed
@@ -672,9 +668,7 @@ public class UtilCache<K, V> implements
                 ((ConcurrentLinkedHashMap) this.memoryTable).setCapacity(newInMemory);
                 return;
             } else {
-                this.memoryTable =new Builder<Object, CacheLine<V>>()
-                    .maximumWeightedCapacity(newInMemory)
-                    .build();
+                this.memoryTable = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.LRU, newInMemory);
             }
         } else {
             this.memoryTable = new ConcurrentHashMap<Object, CacheLine<V>>();