jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java
equal
deleted
inserted
replaced
580 // Only allow MXBean interfaces from rt.jar loaded by the |
580 // Only allow MXBean interfaces from rt.jar loaded by the |
581 // bootstrap class loader |
581 // bootstrap class loader |
582 final Class<?> cls = mxbeanInterface; |
582 final Class<?> cls = mxbeanInterface; |
583 ClassLoader loader = |
583 ClassLoader loader = |
584 AccessController.doPrivileged( |
584 AccessController.doPrivileged( |
585 (PrivilegedAction<ClassLoader>) () -> cls.getClassLoader()); |
585 (PrivilegedAction<ClassLoader>) () -> cls.getClassLoader()); |
586 if (!sun.misc.VM.isSystemDomainLoader(loader)) { |
586 if (!sun.misc.VM.isSystemDomainLoader(loader)) { |
587 throw new IllegalArgumentException(mxbeanName + |
587 throw new IllegalArgumentException(mxbeanName + |
588 " is not a platform MXBean"); |
588 " is not a platform MXBean"); |
589 } |
589 } |
590 |
590 |
881 ServiceLoader.loadInstalled(PlatformMBeanProvider.class) |
881 ServiceLoader.loadInstalled(PlatformMBeanProvider.class) |
882 .forEach(all::add); |
882 .forEach(all::add); |
883 all.add(new DefaultPlatformMBeanProvider()); |
883 all.add(new DefaultPlatformMBeanProvider()); |
884 return all; |
884 return all; |
885 }, null, new FilePermission("<<ALL FILES>>", "read"), |
885 }, null, new FilePermission("<<ALL FILES>>", "read"), |
886 new RuntimePermission("sun.management.spi.PlatformMBeanProvider")); |
886 new RuntimePermission("sun.management.spi.PlatformMBeanProvider.subclass")); |
887 |
887 |
888 // load all platform components into a map |
888 // load all platform components into a map |
889 componentMap = providers.stream() |
889 componentMap = providers.stream() |
890 .flatMap(p -> toPlatformComponentStream(p)) |
890 .flatMap(p -> toPlatformComponentStream(p)) |
891 // The first one wins if multiple PlatformComponents |
891 // The first one wins if multiple PlatformComponents |
968 " can have more than one instance"); |
968 " can have more than one instance"); |
969 } |
969 } |
970 return singleton; |
970 return singleton; |
971 } |
971 } |
972 } |
972 } |
|
973 |
|
974 static { |
|
975 AccessController.doPrivileged((PrivilegedAction<Void>) () -> { |
|
976 System.loadLibrary("management"); |
|
977 return null; |
|
978 }); |
|
979 } |
973 } |
980 } |