use of com.haulmont.cuba.core.entity.JmxInstance in project cuba by cuba-platform.
the class ThreadsDatasource method getStackTrace.
protected String getStackTrace(Long threadId) {
JmxInstance node = (JmxInstance) savedParameters.get("node");
ManagedBeanInfo threadingBean = jmxControlAPI.getManagedBean(node, "java.lang:type=Threading");
ManagedBeanOperation getThreadInfo = jmxControlAPI.getOperation(threadingBean, "getThreadInfo", new String[] { "long", "int" });
CompositeData threadInfo = (CompositeData) jmxControlAPI.invokeOperation(getThreadInfo, new Object[] { threadId, Integer.MAX_VALUE });
StringBuilder sb = new StringBuilder();
if (threadInfo != null) {
CompositeData[] traces = (CompositeData[]) threadInfo.get("stackTrace");
ThreadSnapshot t = getThreadSnapshot(threadId);
sb.append(t.getName()).append(" [id=").append(threadId).append("] (").append(t.getStatus()).append(")\n");
for (CompositeData trace : traces) {
String className = (String) trace.get("className");
String methodName = (String) trace.get("methodName");
int line = (int) trace.get("lineNumber");
sb.append(className).append(".").append(methodName).append(":").append(line).append("\n");
}
}
return sb.toString();
}
Aggregations