commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juozas Baliuka" <>
Subject Re: [PATCH][collections] purging reference map entries when key is garbage collected
Date Wed, 30 Apr 2003 13:20:37 GMT

> <background>
> i'm looking into per context classloader BeanUtilsBean instances. the idea
> is that each web app can have it's own isolated instances (rather than a
> singleton) return on the basis on the thread's contest classloader.
> </background>

Possible I do not understan a use case, but
each web will  have it's own isolated instances, if  beanutils.jar is cloned
per each WEB-INF/lib .
Do you want to have "global" jar loaded by single class loader, but
singletons per classLoader ?
You can use ThreadLocal, it is internaly implemented as weak map without
dependancy on collections.

> i need a map which holds it's keys with a weak reference and when the key
> is garbage collected, the entry and the value needs to be purged from the
> map. i tested WeakHashMap and it doesn't seem to fit the bill. i tried
> ReferenceMap but this does not purge (hard referenced) values when the key
> is collected.
> i've patched ReferenceMap so that it can be setup to do what i need (see
> attachment below).
> - robert


> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message