RFR: 8223260: NamingManager should cache InitialContextFactory

Alan Bateman Alan.Bateman at oracle.com
Wed Jan 29 16:27:51 UTC 2020


On 29/01/2020 15:55, Daniel Fuchs wrote:
> Hi Seán,
>
>> http://cr.openjdk.java.net/~coffeys/webrev.8223260.v1/webrev/
>> A WeakHashKey with the TCCL as the key should be okay here.
>
> If the TCCL is the key then there are good chances that the
> concrete factory class is expected to be loaded by the TCCL.
>
> If that happens then the value will reference the key and
> nothing will ever get garbage collected.
I don't know how much JNDI is used much beyond LDAP these days but you 
are right that a factory with a strong ref to the TCCL would prevent it 
from being GC'ed.  The internal WeakPairMap might be useful here.

-Alan


More information about the core-libs-dev mailing list