Java Code Examples for java.lang.management.PlatformManagedObject

The following are top voted examples for showing how to use java.lang.management.PlatformManagedObject. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: jdk8u-jdk   File: GetObjectName.java   View source code 6 votes vote down vote up
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");
                    }
                }
            }
        });
    }
}
 
Example 2
Project: openjdk-jdk10   File: GetObjectName.java   View source code 6 votes vote down vote up
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");
                    }
                }
            }
        });
    }
}
 
Example 3
Project: openjdk9   File: GetObjectName.java   View source code 6 votes vote down vote up
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");
                    }
                }
            }
        });
    }
}
 
Example 4
Project: jdk8u_jdk   File: GetObjectName.java   View source code 6 votes vote down vote up
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");
                    }
                }
            }
        });
    }
}
 
Example 5
Project: lookaside_java-1.8.0-openjdk   File: GetObjectName.java   View source code 6 votes vote down vote up
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");
                    }
                }
            }
        });
    }
}
 
Example 6
Project: infobip-open-jdk-8   File: GetObjectName.java   View source code 6 votes vote down vote up
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");
                    }
                }
            }
        });
    }
}
 
Example 7
Project: jdk8u-dev-jdk   File: GetObjectName.java   View source code 6 votes vote down vote up
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");
                    }
                }
            }
        });
    }
}
 
Example 8
Project: OLD-OpenJDK8   File: GetObjectName.java   View source code 6 votes vote down vote up
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");
                    }
                }
            }
        });
    }
}
 
Example 9
Project: openjdk-jdk7u-jdk   File: GetObjectName.java   View source code 6 votes vote down vote up
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");
                    }
                }
            }
        });
    }
}
 
Example 10
Project: openjdk-icedtea7   File: GetObjectName.java   View source code 6 votes vote down vote up
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");
                    }
                }
            }
        });
    }
}
 
Example 11
Project: java-memory-assistant   File: HeapDumpCreator.java   View source code 5 votes vote down vote up
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;
}
 
Example 12
Project: https-github.com-g0t4-jenkins2-course-spring-boot   File: HeapdumpMvcEndpoint.java   View source code 5 votes vote down vote up
@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);
	}
}
 
Example 13
Project: otj-jvm   File: Memory.java   View source code 5 votes vote down vote up
@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;
}
 
Example 14
Project: indoqa-boot   File: HeapDumpResources.java   View source code 5 votes vote down vote up
@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);
    }
}
 
Example 15
Project: OpenJSharp   File: ExtendedPlatformComponent.java   View source code 4 votes vote down vote up
/**
 * 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;
}
 
Example 16
Project: jdk8u-jdk   File: ExtendedPlatformComponent.java   View source code 4 votes vote down vote up
/**
 * 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;
}
 
Example 17
Project: jdk8u_jdk   File: ExtendedPlatformComponent.java   View source code 4 votes vote down vote up
/**
 * 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;
}
 
Example 18
Project: lookaside_java-1.8.0-openjdk   File: ExtendedPlatformComponent.java   View source code 4 votes vote down vote up
/**
 * 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;
}
 
Example 19
Project: infobip-open-jdk-8   File: ExtendedPlatformComponent.java   View source code 4 votes vote down vote up
/**
 * 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;
}
 
Example 20
Project: jdk8u-dev-jdk   File: ExtendedPlatformComponent.java   View source code 4 votes vote down vote up
/**
 * 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;
}
 
Example 21
Project: OpenJSharp   File: ExtendedPlatformComponent.java   View source code 2 votes vote down vote up
/**
 * 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();
}
 
Example 22
Project: jdk8u-jdk   File: ExtendedPlatformComponent.java   View source code 2 votes vote down vote up
/**
 * 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();
}
 
Example 23
Project: jdk8u_jdk   File: ExtendedPlatformComponent.java   View source code 2 votes vote down vote up
/**
 * 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();
}
 
Example 24
Project: lookaside_java-1.8.0-openjdk   File: ExtendedPlatformComponent.java   View source code 2 votes vote down vote up
/**
 * 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();
}
 
Example 25
Project: infobip-open-jdk-8   File: ExtendedPlatformComponent.java   View source code 2 votes vote down vote up
/**
 * 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();
}
 
Example 26
Project: jdk8u-dev-jdk   File: ExtendedPlatformComponent.java   View source code 2 votes vote down vote up
/**
 * 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();
}