Search in sources :

Example 11 with JmxInstance

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();
}
Also used : ManagedBeanOperation(com.haulmont.cuba.web.jmx.entity.ManagedBeanOperation) CompositeData(javax.management.openmbean.CompositeData) ManagedBeanInfo(com.haulmont.cuba.web.jmx.entity.ManagedBeanInfo) JmxInstance(com.haulmont.cuba.core.entity.JmxInstance)

Aggregations

JmxInstance (com.haulmont.cuba.core.entity.JmxInstance)11 ParamsMap (com.haulmont.bali.util.ParamsMap)3 Metadata (com.haulmont.cuba.core.global.Metadata)3 OpenType (com.haulmont.cuba.gui.WindowManager.OpenType)3 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)3 BaseAction (com.haulmont.cuba.gui.components.actions.BaseAction)3 CollectionDatasource (com.haulmont.cuba.gui.data.CollectionDatasource)3 JmxInstanceEditor (com.haulmont.cuba.web.app.ui.jmxinstance.edit.JmxInstanceEditor)3 JmxControlAPI (com.haulmont.cuba.web.jmx.JmxControlAPI)3 JmxControlException (com.haulmont.cuba.web.jmx.JmxControlException)3 ManagedBeanInfo (com.haulmont.cuba.web.jmx.entity.ManagedBeanInfo)3 Inject (javax.inject.Inject)3 LogControlException (com.haulmont.cuba.core.sys.logging.LogControlException)2 ExportDisplay (com.haulmont.cuba.gui.export.ExportDisplay)2 LogDataProvider (com.haulmont.cuba.web.export.LogDataProvider)2 ManagedBeanOperation (com.haulmont.cuba.web.jmx.entity.ManagedBeanOperation)2 Map (java.util.Map)2 UUID (java.util.UUID)2 StringUtils (org.apache.commons.lang.StringUtils)2 Level (ch.qos.logback.classic.Level)1