Proposal: javax.naming.spi.NamingManager.clearInitialContextFactoryBuilder()

Alan Bateman Alan.Bateman at
Wed May 10 12:32:47 UTC 2017

On 08/05/2017 23:27, Andrew Guibert wrote:

> :
> I am not sure why the "no resetting" restriction is on the NamingManager
> API in the first place.  Is anyone aware why the API has this restriction?
> In any case, the solution outlined above seems rather messy (as it only
> solves the problem by mitigating a classloader leak), so I would like to
> propose the following addition to the NamingManager API:
I checked with one of the engineers that worked on the JNDI API a long 
time ago and there doesn't seem to be any significant reason to disallow 
it be changed.

Looking at it now then it might be simpler to change 
setInitialContextFactoryBuilder to allow a new builder to be set rather 
than introducing a clearXXX method. I can't imagine anything but tests 
relying on IllegalStateException to be thrown if already set. A variant 
to explore is setting the builder to a placeholder InitialContextFactory 
rather than null.

So is your plan to proposal a patch and tests for this?


More information about the core-libs-dev mailing list