< prev index next >

src/java.management/share/classes/javax/management/MBeanServerFactory.java

Print this page




 441         final ClassLoader loader =
 442                 Thread.currentThread().getContextClassLoader();
 443 
 444         if (loader != null) {
 445             // Try with context class loader
 446             return loader.loadClass(builderClassName);
 447         }
 448 
 449         // No context class loader? Try with Class.forName()
 450         return ReflectUtil.forName(builderClassName);
 451     }
 452 
 453     /**
 454      * Creates the initial builder according to the
 455      * javax.management.builder.initial System property - if specified.
 456      * If any checked exception needs to be thrown, it is embedded in
 457      * a JMRuntimeException.
 458      **/
 459     private static MBeanServerBuilder newBuilder(Class<?> builderClass) {
 460         try {

 461             final Object abuilder = builderClass.newInstance();
 462             return (MBeanServerBuilder)abuilder;
 463         } catch (RuntimeException x) {
 464             throw x;
 465         } catch (Exception x) {
 466             final String msg =
 467                     "Failed to instantiate a MBeanServerBuilder from " +
 468                     builderClass + ": " + x;
 469             throw new JMRuntimeException(msg, x);
 470         }
 471     }
 472 
 473     /**
 474      * Instantiate a new builder according to the
 475      * javax.management.builder.initial System property - if needed.
 476      **/
 477     private static synchronized void checkMBeanServerBuilder() {
 478         try {
 479             GetPropertyAction act =
 480                     new GetPropertyAction(JMX_INITIAL_BUILDER);




 441         final ClassLoader loader =
 442                 Thread.currentThread().getContextClassLoader();
 443 
 444         if (loader != null) {
 445             // Try with context class loader
 446             return loader.loadClass(builderClassName);
 447         }
 448 
 449         // No context class loader? Try with Class.forName()
 450         return ReflectUtil.forName(builderClassName);
 451     }
 452 
 453     /**
 454      * Creates the initial builder according to the
 455      * javax.management.builder.initial System property - if specified.
 456      * If any checked exception needs to be thrown, it is embedded in
 457      * a JMRuntimeException.
 458      **/
 459     private static MBeanServerBuilder newBuilder(Class<?> builderClass) {
 460         try {
 461             @SuppressWarnings("deprecation")
 462             final Object abuilder = builderClass.newInstance();
 463             return (MBeanServerBuilder)abuilder;
 464         } catch (RuntimeException x) {
 465             throw x;
 466         } catch (Exception x) {
 467             final String msg =
 468                     "Failed to instantiate a MBeanServerBuilder from " +
 469                     builderClass + ": " + x;
 470             throw new JMRuntimeException(msg, x);
 471         }
 472     }
 473 
 474     /**
 475      * Instantiate a new builder according to the
 476      * javax.management.builder.initial System property - if needed.
 477      **/
 478     private static synchronized void checkMBeanServerBuilder() {
 479         try {
 480             GetPropertyAction act =
 481                     new GetPropertyAction(JMX_INITIAL_BUILDER);


< prev index next >