UtilCache.utilCacheTable WeakHashMap incorrect usage

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

UtilCache.utilCacheTable WeakHashMap incorrect usage

Adam Heath-2
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.
Reply | Threaded
Open this post in threaded view
|

Re: UtilCache.utilCacheTable WeakHashMap incorrect usage

Scott Gray-2
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.


smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: UtilCache.utilCacheTable WeakHashMap incorrect usage

Adam Heath-2
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';