RFR: 8223260: NamingManager should cache InitialContextFactory

Seán Coffey sean.coffey at oracle.com
Wed Jan 29 17:22:38 UTC 2020


Thanks for the reviews. I found an issue with the new test also -

it's loading the custom factory class via the non-serviceloader 
approach. I was hoping to exercise ServiceLoader here. I'll address this 
and the comments raised and revert with a new patch shortly.

Regards,
Sean.

On 29/01/20 16:27, Alan Bateman wrote:
> 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