RFR [9] 8072839: JAX-B Plugability Layer: using java.util.ServiceLoader

Miroslav Kos miroslav.kos at oracle.com
Tue May 26 22:50:12 UTC 2015


On 20/05/15 15:30, Daniel Fuchs wrote:
> Hi Miroslav,
>
> I haven't looked in all details, but this text in JAXBContext.java looks
> odd to me - it seems that the bullet is repeated twice (or if they
> differ - the diff must be subtle):
>
> lines 241-257 seem identical to lines 259-275
>
>  241  * <li>
>  242  * Look for resource 
> <tt>/META-INF/services/javax.xml.bind.JAXBContext</tt> using provided 
> class loader.
>  243  * Methods without class loader parameter use {@code 
> Thread.currentThread().getContextClassLoader()}.
>  244  * If such a resource exists, its content is assumed to be the 
> provider factory class and must supply
>  245  * an implementation class containing the following method 
> signatures:
>  246  *
>  247  * <pre>
>  248  *
>  249  * public static JAXBContext createContext(
>  250  *                                      String contextPath,
>  251  *                                      ClassLoader classLoader,
>  252  * Map<String,Object> properties throws JAXBException
>  253  *
>  254  * public static JAXBContext createContext(
>  255  *                                      Class[] classes,
>  256  * Map<String,Object> properties ) throws JAXBException
>  257  * </pre>
>  258  *
>  259  * <li>
>  260  * Look for resource 
> <tt>/META-INF/services/javax.xml.bind.JAXBContext</tt> using provided 
> class loader.
>  261  * Methods without class loader parameter use {@code 
> Thread.currentThread().getContextClassLoader()}.
>  262  * If such a resource exists, its content is assumed to be the 
> provider factory class and must supply
>  263  * an implementation class containing the following method 
> signatures:
>  264  *
>  265  * <pre>
>  266  *
>  267  * public static JAXBContext createContext(
>  268  *                                      String contextPath,
>  269  *                                      ClassLoader classLoader,
>  270  * Map<String,Object> properties throws JAXBException
>  271  *
>  272  * public static JAXBContext createContext(
>  273  *                                      Class[] classes,
>  274  * Map<String,Object> properties ) throws JAXBException
>  275  * </pre>
Hi Daniel,
thanks for catching this - obviously incorrectly applied patch.
>
> So if I understand well - this is somewhat similar to what
> ServiceLoader does in terms of lookup, except that the
> mechanism defined here does not use an instance of the
> declared class, nor require that the class declared in
> /META-INF/services/javax.xml.bind.JAXBContext
> is a subclass of JAXBContext - but simply that it defines
> the appropriate static factory methods...
Yes, exactly. It is "ServiceLoader like" implementation from times when 
ServiceLoader wasn't in jdk yet (jdk5).
>
> Maybe the fact that this step is deprecated should be noted more
> prominently in the bullet itself.
I added a note mentioning that the step is deprecated.

Corrected version: http://cr.openjdk.java.net/~mkos/8072839/jaxws.03/
I also came over the changed files and added new lines to make lines 
shorter.

Thanks
Miran

>
> best regards,
>
> -- daniel
>
> On 15/05/15 17:13, Miroslav Kos wrote:
>> Hi everybody,
>>
>> this is review request for: 8072839: JAX-B Plugability Layer: using
>> java.util.ServiceLoader
>> The JAX-B API changed a little bit - proprietary ServiceLoader-like code
>> has been replaced by java.util.ServiceLoader. This change is required by
>> Jigsaw, old configuration way still supported.
>>
>> JBS:https://bugs.openjdk.java.net/browse/JDK-8072839
>> webrev: http://cr.openjdk.java.net/~mkos/8072839/jaxws.02/index.html
>> CCC: http://ccc.us.oracle.com/8072839
>>
>> Testing: JAX-WS (standalone) unit tests, no, jtreg tests available now,
>> TCK/JCK tests will require new tests.
>>
>> Thanks
>> Miran
>>
>




More information about the core-libs-dev mailing list