Administrator
|
Hey god news Adam, you should tell Ben ;o)
BTW as we don't use any weighers I have removed the import and some others at r948460 I also wondered if we should keep addAllFileTableValues which is not used internally (hence I guess useless) but I finally stopped as there were also some other Type Safety warnings and I did not have time to continue Jacques From: <[hidden email]> > Author: doogie > Date: Wed May 26 14:23:11 2010 > New Revision: 948449 > > URL: http://svn.apache.org/viewvc?rev=948449&view=rev > Log: > Re-apply 948328, which brings us back to using the more efficient clhm, > but now UtilCache is not strictly least-recently-used. Instead, it's > more of a less-recently-used. This difference can be seen when reducing > the max-in-memory setting(but not reducing completely to 0). > > Added: > ofbiz/trunk/framework/base/lib/clhm-release-1.0-lru.jar > Removed: > ofbiz/trunk/framework/base/lib/clhm-20100316.jar > Modified: > ofbiz/trunk/.classpath > ofbiz/trunk/LICENSE > ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java > ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java > > Modified: ofbiz/trunk/.classpath > URL: http://svn.apache.org/viewvc/ofbiz/trunk/.classpath?rev=948449&r1=948448&r2=948449&view=diff > ============================================================================== > --- ofbiz/trunk/.classpath (original) > +++ ofbiz/trunk/.classpath Wed May 26 14:23: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-20100316.jar"/> > + <classpathentry kind="lib" path="framework/base/lib/clhm-release-1.0-lru.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=948449&r1=948448&r2=948449&view=diff > ============================================================================== > --- ofbiz/trunk/LICENSE (original) > +++ ofbiz/trunk/LICENSE Wed May 26 14:23: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-20100316.jar > +ofbiz/trunk/framework/base/lib/clhm-release-1.0-lru.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-release-1.0-lru.jar > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/clhm-release-1.0-lru.jar?rev=948449&view=auto > ============================================================================== > Files ofbiz/trunk/framework/base/lib/clhm-release-1.0-lru.jar (added) and ofbiz/trunk/framework/base/lib/clhm-release-1.0-lru.jar > Wed May 26 14:23: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=948449&r1=948448&r2=948449&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 14:23:11 2010 > @@ -38,7 +38,9 @@ import java.util.concurrent.TimeUnit; > import java.util.concurrent.atomic.AtomicInteger; > import java.util.concurrent.atomic.AtomicLong; > > -import com.reardencommerce.kernel.collections.shared.evictable.ConcurrentLinkedHashMap; > +import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap; > +import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.Builder; > +import com.googlecode.concurrentlinkedhashmap.Weighers; > > import javolution.util.FastList; > import javolution.util.FastMap; > @@ -143,7 +145,9 @@ public class UtilCache<K, V> implements > if (maxMemSize == 0) { > memoryTable = new ConcurrentHashMap<Object, CacheLine<V>>(); > } else { > - memoryTable = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.LRU, maxMemSize); > + memoryTable = new Builder<Object, CacheLine<V>>() > + .maximumWeightedCapacity(maxMemSize) > + .build(); > } > if (this.useFileSystemStore) { > // create the manager the first time it is needed > @@ -723,7 +727,9 @@ public class UtilCache<K, V> implements > ((ConcurrentLinkedHashMap) this.memoryTable).setCapacity(newInMemory); > return; > } else { > - this.memoryTable = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.LRU, newInMemory); > + this.memoryTable =new Builder<Object, CacheLine<V>>() > + .maximumWeightedCapacity(newInMemory) > + .build(); > } > } else { > this.memoryTable = new ConcurrentHashMap<Object, CacheLine<V>>(); > > Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java?rev=948449&r1=948448&r2=948449&view=diff > ============================================================================== > --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java (original) > +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java Wed May 26 14:23:11 2010 > @@ -346,9 +346,8 @@ public class UtilCacheTests extends Gene > assertKey(s, cache, s, new String(s), new String(":" + s), i + 1, map); > } > cache.setMaxInMemory(2); > - for (int i = 0; i < size - 2; i++) { > - map.remove(Integer.toString(i)); > - } > + assertEquals("cache.size", 2, cache.size()); > + map.keySet().retainAll(cache.getCacheLineKeys()); > assertEquals("map-keys", map.keySet(), cache.getCacheLineKeys()); > assertEquals("map-values", map.values(), cache.values()); > cache.setMaxInMemory(0); > > |
Jacques Le Roux wrote:
> Hey god news Adam, you should tell Ben ;o) > BTW as we don't use any weighers I have removed the import and some > others at r948460 > I also wondered if we should keep addAllFileTableValues which is not > used internally (hence I guess useless) but I finally stopped as there > were also some other Type Safety warnings and I did not have time to > continue I mentioned it in the bug report. Was that just a typo, or did you really mean to call me a god? :) > > Jacques > > From: <[hidden email]> >> Author: doogie >> Date: Wed May 26 14:23:11 2010 >> New Revision: 948449 >> >> URL: http://svn.apache.org/viewvc?rev=948449&view=rev >> Log: >> Re-apply 948328, which brings us back to using the more efficient clhm, >> but now UtilCache is not strictly least-recently-used. Instead, it's >> more of a less-recently-used. This difference can be seen when reducing >> the max-in-memory setting(but not reducing completely to 0). >> >> Added: >> ofbiz/trunk/framework/base/lib/clhm-release-1.0-lru.jar >> Removed: >> ofbiz/trunk/framework/base/lib/clhm-20100316.jar >> Modified: >> ofbiz/trunk/.classpath >> ofbiz/trunk/LICENSE >> >> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java >> >> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java >> >> >> Modified: ofbiz/trunk/.classpath >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/.classpath?rev=948449&r1=948448&r2=948449&view=diff |
Administrator
|
From: "Adam Heath" <[hidden email]>
> Jacques Le Roux wrote: >> Hey god news Adam, you should tell Ben ;o) >> BTW as we don't use any weighers I have removed the import and some >> others at r948460 >> I also wondered if we should keep addAllFileTableValues which is not >> used internally (hence I guess useless) but I finally stopped as there >> were also some other Type Safety warnings and I did not have time to >> continue > > I mentioned it in the bug report. Sorry, which bug report? > Was that just a typo, or did you really mean to call me a god? :) You need some rest :D Jacques >> >> Jacques >> >> From: <[hidden email]> >>> Author: doogie >>> Date: Wed May 26 14:23:11 2010 >>> New Revision: 948449 >>> >>> URL: http://svn.apache.org/viewvc?rev=948449&view=rev >>> Log: >>> Re-apply 948328, which brings us back to using the more efficient clhm, >>> but now UtilCache is not strictly least-recently-used. Instead, it's >>> more of a less-recently-used. This difference can be seen when reducing >>> the max-in-memory setting(but not reducing completely to 0). >>> >>> Added: >>> ofbiz/trunk/framework/base/lib/clhm-release-1.0-lru.jar >>> Removed: >>> ofbiz/trunk/framework/base/lib/clhm-20100316.jar >>> Modified: >>> ofbiz/trunk/.classpath >>> ofbiz/trunk/LICENSE >>> >>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java >>> >>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java >>> >>> >>> Modified: ofbiz/trunk/.classpath >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/.classpath?rev=948449&r1=948448&r2=948449&view=diff > |
Jacques Le Roux wrote:
> From: "Adam Heath" <[hidden email]> >> Jacques Le Roux wrote: >>> Hey god news Adam, you should tell Ben ;o) >>> BTW as we don't use any weighers I have removed the import and some >>> others at r948460 >>> I also wondered if we should keep addAllFileTableValues which is not >>> used internally (hence I guess useless) but I finally stopped as there >>> were also some other Type Safety warnings and I did not have time to >>> continue >> >> I mentioned it in the bug report. > > Sorry, which bug report? The one you already commented on, 3779. |
Administrator
|
From: "Adam Heath" <[hidden email]>
> Jacques Le Roux wrote: >> From: "Adam Heath" <[hidden email]> >>> Jacques Le Roux wrote: >>>> Hey god news Adam, you should tell Ben ;o) >>>> BTW as we don't use any weighers I have removed the import and some >>>> others at r948460 >>>> I also wondered if we should keep addAllFileTableValues which is not >>>> used internally (hence I guess useless) but I finally stopped as there >>>> were also some other Type Safety warnings and I did not have time to >>>> continue >>> >>> I mentioned it in the bug report. >> >> Sorry, which bug report? > > The one you already commented on, 3779. OK, I don't understand, nevermind forget it ;o) Jacques |
Free forum by Nabble | Edit this page |