You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Adam Heath <do...@brainfood.com> on 2009/11/22 22:21:44 UTC

UtilCache.utilCacheTable WeakHashMap incorrect usage

UtilCache.utilCacheTable is a WeakHashMap.  This class is defined to
clear out entries when the *key* is only weakly referenced.  Since the
key in this case is a string, the usage really doesn't make sense.
Either the cache item will be kept forever(if the cache is configured
with a static string name, that exists in the constant pool, or with
an interned string), or will be cleared earlier, because the string is
dynamic, existing in the heap or the stack.

So, this usage makes no sense at all.

Re: UtilCache.utilCacheTable WeakHashMap incorrect usage

Posted by Adam Heath <do...@brainfood.com>.
Scott Gray wrote:
> Umm... http://svn.ofbiz.org/viewcvs?rev=2202&view=rev :-)

SELECT DISTINCT a.partyId, a.firstName, b.lastName FROM Person a JOIN
FaceAttributes b ON a.partyId = b.partyId WHERE b.faceAttributeTypeId
= 'EGG';


Re: UtilCache.utilCacheTable WeakHashMap incorrect usage

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Umm... http://svn.ofbiz.org/viewcvs?rev=2202&view=rev :-)

Regards
Scott

On 23/11/2009, at 10:21 AM, Adam Heath wrote:

> UtilCache.utilCacheTable is a WeakHashMap.  This class is defined to
> clear out entries when the *key* is only weakly referenced.  Since the
> key in this case is a string, the usage really doesn't make sense.
> Either the cache item will be kept forever(if the cache is configured
> with a static string name, that exists in the constant pool, or with
> an interned string), or will be cleared earlier, because the string is
> dynamic, existing in the heap or the stack.
>
> So, this usage makes no sense at all.