Search in sources :

Example 1 with IMBeanServer

use of org.talend.designer.runtime.visualization.MBean.IMBeanServer in project tdi-studio-se by Talend.

the class RuntimeGraphcsComposite method loadOverviewChartSet.

private void loadOverviewChartSet(IActiveJvm activeJvm) throws JvmCoreException {
    final int[] blue = new int[] { 0, 255, 255 };
    final int[] red = new int[] { 255, 0, 0 };
    final int[] green = new int[] { 0, 255, 0 };
    final int[] lightgeen = new int[] { 128, 255, 0 };
    final int[] darkRed = new int[] { 255, 0, 128 };
    final int[] orange = new int[] { 255, 255, 0 };
    IMBeanServer server = activeJvm.getMBeanServer();
    server.getMonitoredAttributeGroups().clear();
    IMonitoredMXBeanGroup group = server.addMonitoredAttributeGroup(MonitorAttributeName.HEAP_MEMORY, AxisUnit.MBytes);
    group.addAttribute(ManagementFactory.MEMORY_MXBEAN_NAME, MonitorAttributeName.HEAP_MEMORY_USE, green);
    group.addAttribute(ManagementFactory.MEMORY_MXBEAN_NAME, MonitorAttributeName.HEAP_MEMORY_SIZE, darkRed);
    group.addAttribute(ManagementFactory.MEMORY_MXBEAN_NAME, MonitorAttributeName.HEAP_MEMORY_NINTY, blue);
    group.addAttribute(ManagementFactory.MEMORY_MXBEAN_NAME, MonitorAttributeName.HEAP_MEMORY_THREE_QUARTER, orange);
    group = server.addMonitoredAttributeGroup(MonitorAttributeName.CPU_USE, AxisUnit.Percent);
    group.addAttribute(ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME, MonitorAttributeName.CPU_TIME, lightgeen);
}
Also used : IMBeanServer(org.talend.designer.runtime.visualization.MBean.IMBeanServer) IMonitoredMXBeanGroup(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup)

Example 2 with IMBeanServer

use of org.talend.designer.runtime.visualization.MBean.IMBeanServer in project tdi-studio-se by Talend.

the class RuntimeGraphcsComposite method setInput.

@Override
protected void setInput(ISelection selection, IActiveJvm newJvm, IActiveJvm oldJvm) {
    if (newJvm == null || newJvm.equals(oldJvm)) {
        return;
    }
    reconstructCharts(newJvm, false);
    if (oldJvm != null && mBeanServerChangeListener != null) {
        IMBeanServer server = oldJvm.getMBeanServer();
        if (server != null) {
            server.removeServerChangeListener(mBeanServerChangeListener);
        }
    }
    newJvm.getMBeanServer().addServerChangeListener(mBeanServerChangeListener);
}
Also used : IMBeanServer(org.talend.designer.runtime.visualization.MBean.IMBeanServer)

Example 3 with IMBeanServer

use of org.talend.designer.runtime.visualization.MBean.IMBeanServer in project tdi-studio-se by Talend.

the class TimelineSection method setInput.

/*
     * @see AbstractJvmPropertySection#setInput(IWorkbenchPart, ISelection, IActiveJvm, IActiveJvm)
     */
@Override
protected void setInput(IWorkbenchPart part, ISelection selection, IActiveJvm newJvm, IActiveJvm oldJvm) {
    if (newJvm == null || newJvm.equals(oldJvm)) {
        return;
    }
    reconstructCharts(newJvm, false);
    if (oldJvm != null && mBeanServerChangeListener != null) {
        IMBeanServer server = oldJvm.getMBeanServer();
        if (server != null) {
            server.removeServerChangeListener(mBeanServerChangeListener);
        }
    }
    newJvm.getMBeanServer().addServerChangeListener(mBeanServerChangeListener);
}
Also used : IMBeanServer(org.talend.designer.runtime.visualization.MBean.IMBeanServer)

Example 4 with IMBeanServer

use of org.talend.designer.runtime.visualization.MBean.IMBeanServer in project tdi-studio-se by Talend.

the class TimelineSection method dispose.

/*
     * @see AbstractJvmPropertySection#dispose()
     */
@Override
public void dispose() {
    super.dispose();
    IActiveJvm jvm = getJvm();
    if (jvm != null) {
        IMBeanServer server = jvm.getMBeanServer();
        if (server != null) {
            server.removeServerChangeListener(mBeanServerChangeListener);
        }
    }
}
Also used : IMBeanServer(org.talend.designer.runtime.visualization.MBean.IMBeanServer) IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm)

Example 5 with IMBeanServer

use of org.talend.designer.runtime.visualization.MBean.IMBeanServer in project tdi-studio-se by Talend.

the class LoadChartSetAction method loadChartSet.

/**
     * Loads the given memento of chart set.
     * 
     * @param memento The memento
     * @throws JvmCoreException
     */
private void loadChartSet(IMemento memento) throws JvmCoreException {
    IMBeanServer server = section.getJvm().getMBeanServer();
    server.getMonitoredAttributeGroups().clear();
    StringBuffer buffer = new StringBuffer();
    for (IMemento groupMemento : memento.getChildren(GROUP)) {
        IMonitoredMXBeanGroup group = server.addMonitoredAttributeGroup(groupMemento.getID(), AxisUnit.valueOf(groupMemento.getString(UNIT)));
        for (IMemento attributeMemento : groupMemento.getChildren(ATTRIBUTE)) {
            String objectName = attributeMemento.getString(OBJECT_NAME);
            String attributeName = attributeMemento.getID();
            if (attributeExist(objectName, attributeName)) {
                group.addAttribute(objectName, attributeName, getRGB(attributeMemento.getString(COLOR)));
            } else {
                buffer.append('\n');
                buffer.append(objectName + ':' + attributeName);
            }
        }
    }
    if (buffer.length() > 0) {
        MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.errorDialogTitle, NLS.bind(Messages.attributeNotSupportedMsg, buffer.toString()));
    }
}
Also used : IMBeanServer(org.talend.designer.runtime.visualization.MBean.IMBeanServer) IMonitoredMXBeanGroup(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup) IMemento(org.eclipse.ui.IMemento)

Aggregations

IMBeanServer (org.talend.designer.runtime.visualization.MBean.IMBeanServer)10 IMonitoredMXBeanGroup (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup)7 IMemento (org.eclipse.ui.IMemento)2 IActiveJvm (org.talend.designer.runtime.visualization.IActiveJvm)1