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

Daniel Fuchs daniel.fuchs at oracle.com
Wed May 20 13:30:35 UTC 2015


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 *

  • 242 * Look for resource /META-INF/services/javax.xml.bind.JAXBContext 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 *
      248  *
      249  * public static JAXBContext createContext(
      250  *                                      String contextPath,
      251  *                                      ClassLoader classLoader,
      252  *                                      Map 
    properties throws JAXBException
      253  *
      254  * public static JAXBContext createContext(
      255  *                                      Class[] classes,
      256  *                                      Map 
    properties ) throws JAXBException
      257  * 
    258 * 259 *
  • 260 * Look for resource /META-INF/services/javax.xml.bind.JAXBContext 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 *
      266  *
      267  * public static JAXBContext createContext(
      268  *                                      String contextPath,
      269  *                                      ClassLoader classLoader,
      270  *                                      Map 
    properties throws JAXBException
      271  *
      272  * public static JAXBContext createContext(
      273  *                                      Class[] classes,
      274  *                                      Map 
    properties ) throws JAXBException
      275  * 
  • 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...

    Maybe the fact that this step is deprecated should be noted more prominently in the bullet itself.

    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