List of usage examples for java.lang.management PlatformManagedObject getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.kuali.test.runner.execution.TestExecutionContext.java
private String getValueFromMXBeanObject(String name, PlatformManagedObject mxbean) { String retval = null;//from ww w.j a va2 s . c o m try { Method m = mxbean.getClass().getMethod("get" + name, new Class[0]); if (m != null) { Object o = m.invoke(mxbean); if (o != null) { if (o instanceof MemoryUsage) { MemoryUsage mu = (MemoryUsage) o; retval = "" + mu.getUsed(); } else { retval = o.toString(); } } } } catch (Exception ex) { } ; return retval; }