Example usage for java.lang.management ThreadMXBean getClass

List of usage examples for java.lang.management ThreadMXBean getClass

Introduction

In this page you can find the example usage for java.lang.management ThreadMXBean getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:Main.java

private static long[] findDeadlockedThreads(ThreadMXBean threadBean) throws SecurityException,
        NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
    Method method = threadBean.getClass().getDeclaredMethod("findDeadlockedThreads");
    method.setAccessible(true);/*from  ww w.ja v  a  2 s . c  o  m*/
    return (long[]) method.invoke(threadBean);
}

From source file:Main.java

private static ThreadInfo[] dumpAllThreads(ThreadMXBean threadBean) throws SecurityException,
        NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
    Method method = threadBean.getClass().getDeclaredMethod("dumpAllThreads", boolean.class, boolean.class);
    method.setAccessible(true);//from  w  w w  .j a v  a  2s  .  c o  m
    return (ThreadInfo[]) method.invoke(threadBean, true, true);
}

From source file:Main.java

private static ThreadInfo[] getThreadInfo(long[] threadIds, ThreadMXBean threadBean) throws SecurityException,
        NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
    Method method = threadBean.getClass().getDeclaredMethod("getThreadInfo", long[].class, boolean.class,
            boolean.class);
    method.setAccessible(true);/* www  . ja  va2 s  . c  o m*/
    return (ThreadInfo[]) method.invoke(threadBean, threadIds, true, true);
}