RFR [JDK8]: 7169894: JAXP Plugability Layer: using service loader

Joe Wang huizhe.wang at oracle.com
Fri Jun 22 02:05:24 UTC 2012

On 6/21/2012 2:00 PM, Alan Bateman wrote:
> On 21/06/2012 19:02, Joe Wang wrote:
>> :
>> For the class loader, as discussed with Paul, since the ServiceLoader 
>> does so much, we may be able to skip the 'using different 
>> classloader' part, that is, simply calling load without classloader.  
>> The javadoc states that it's equivalent to load with context class 
>> loader.  But from what I can, it found all that's placed in the 
>> endorsed dir or bootclasspath.  I need to do a few more tests on this.
> It doesn't seem to be specified but the implementation (in at least 
> some places) appears to use the TCCL or the defining loader of the 
> FactoryFinder class (the bootstrap class loader in the case of the 
> JDK). Using the single-argument ServiceLoader.load is probably want 
> you want now.

Yeah, I agree.

>> :
>> Maybe I'm a little confused.  But the fallback to default 
>> implementation is in the spec.  It happens the jaxp ri is installed 
>> as an endorsed technology here and loaded by the ServiceLoader.
> Yes, but ultimately we have to get to the point where we can scale 
> down the platform so you may have an embedded device, for example, 
> that doesn't validating parsers or a XPathFactory installed for 
> example. So I think this wording will need to get adjusted in time to 
> allow for the appropriate *ConfigurationException to be thrown then 
> there isn't any service provider module installed.

Yes, we need better defined error message. In the case where no impl 
module is installed, the current impl would treat it the same as having 
problem loading the default impl, and therefore throw 
*ConfigurationException with an error message sth. like "Provider 
[default impl class name] no found " and ClassNotFoundException as cause.

However, as we discussed before, the current jaxp impl resolution 
process will change further as it becomes clear if there will be some 
sort of "preference mechanism" in module loading.  It's likely we wont 
have the 4th step.  So when the default module is not installed, we 
simply get an empty iterator (no exception), in which case we probably 
need an indicator (Platform.isModuleMode?) to formulate a better error 


> -Alan

More information about the core-libs-dev mailing list