本文整理汇总了Java中java.lang.management.PlatformManagedObject类的典型用法代码示例。如果您正苦于以下问题:Java PlatformManagedObject类的具体用法?Java PlatformManagedObject怎么用?Java PlatformManagedObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlatformManagedObject类属于java.lang.management包,在下文中一共展示了PlatformManagedObject类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: submitTasks
import java.lang.management.PlatformManagedObject; //导入依赖的package包/类
static void submitTasks(ExecutorService executor, int count) {
for (int i=0; i < count && !failed; i++) {
executor.execute(new Runnable() {
@Override
public void run() {
List<PlatformManagedObject> mbeans = new ArrayList<>();
mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class));
mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class));
for (PlatformManagedObject pmo : mbeans) {
// Name should not be null
if (pmo.getObjectName() == null) {
failed = true;
throw new RuntimeException("TEST FAILED: getObjectName() returns null");
}
}
}
});
}
}
示例2: HeapDumpCreator
import java.lang.management.PlatformManagedObject; //导入依赖的package包/类
HeapDumpCreator(final Configuration configuration, final String hostName,
final PlatformManagedObject heapDumpBean, final CommandExecutor commandExecutor,
final Logger logger) throws Exception {
this.configuration = configuration;
this.nameFormatter = new HeapDumpNameFormatter(configuration.getHeapDumpName(), hostName);
this.heapDumpBean = heapDumpBean;
this.heapDumpMethod =
heapDumpBean.getClass().getMethod("dumpHeap", String.class, boolean.class);
this.commandExecutor = commandExecutor;
this.logger = logger;
}
示例3: HotSpotDiagnosticMXBeanHeapDumper
import java.lang.management.PlatformManagedObject; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected HotSpotDiagnosticMXBeanHeapDumper() {
try {
Class<?> diagnosticMXBeanClass = ClassUtils.resolveClassName(
"com.sun.management.HotSpotDiagnosticMXBean", null);
this.diagnosticMXBean = ManagementFactory.getPlatformMXBean(
(Class<PlatformManagedObject>) diagnosticMXBeanClass);
this.dumpHeapMethod = ReflectionUtils.findMethod(diagnosticMXBeanClass,
"dumpHeap", String.class, Boolean.TYPE);
}
catch (Throwable ex) {
throw new HeapDumperUnavailableException(
"Unable to locate HotSpotDiagnosticMXBean", ex);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:HeapdumpMvcEndpoint.java
示例4: getBean
import java.lang.management.PlatformManagedObject; //导入依赖的package包/类
@Nullable
private static <T extends PlatformManagedObject> T getBean(final Class<T> iface) {
final String name = iface.getCanonicalName();
T ret;
try {
ret = ManagementFactory.getPlatformMXBean(iface);
} catch (IllegalArgumentException e) {
LOG.warn("error getting bean {}", name, e);
return null;
}
if (ret == null) {
LOG.warn("bean {} did not exist", name);
}
return ret;
}
示例5: HotSpotDiagnosticMXBeanHeapDumper
import java.lang.management.PlatformManagedObject; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected HotSpotDiagnosticMXBeanHeapDumper() {
try {
Class<?> diagnosticMXBeanClass = ClassUtils.resolveClassName("com.sun.management.HotSpotDiagnosticMXBean", null);
this.diagnosticMXBean = ManagementFactory.getPlatformMXBean((Class<PlatformManagedObject>) diagnosticMXBeanClass);
this.dumpHeapMethod = ReflectionUtils.findMethod(diagnosticMXBeanClass, "dumpHeap", String.class, Boolean.TYPE);
} catch (Throwable ex) {
throw new HeapDumperUnavailableException("Unable to locate HotSpotDiagnosticMXBean", ex);
}
}
示例6: getMXBean
import java.lang.management.PlatformManagedObject; //导入依赖的package包/类
/**
* Returns the extended platform MXBean implementing the given
* mxbeanInterface, or null if there is no such MXBean.
*/
public static <T extends PlatformManagedObject>
T getMXBean(Class<T> mxbeanInterface) {
return null;
}
示例7: getMXBeans
import java.lang.management.PlatformManagedObject; //导入依赖的package包/类
/**
* Get the extended set of platform MXBeans that should be registered in the
* platform MBeanServer, or an empty list if there are no such MXBeans.
*/
public static List<? extends PlatformManagedObject> getMXBeans() {
return Collections.emptyList();
}