use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class Tools method invokeHeapHisto.
/**
* Invokes the heapHisto method of HotSpotVirtualMachine with reflection.
*
* @param virtualMachine The virtual machine
* @param isLive True to dump only live objects
* @return The input stream of heap histo
* @throws JvmCoreException
*/
protected InputStream invokeHeapHisto(Object virtualMachine, boolean isLive) throws JvmCoreException {
try {
Class<?> clazz = Class.forName(HOT_SPOT_VIRTUAL_MACHINE_CLASS);
Method method = clazz.getDeclaredMethod(HEAP_HISTO_METHOD, new Class[] { Object[].class });
Object[] arg = new Object[] { isLive ? HEAP_HISTO_LIVE_OPTION : HEAP_HISTO_ALL_OPTION };
return (InputStream) method.invoke(virtualMachine, (Object) arg);
} catch (Throwable t) {
throw new JvmCoreException(IStatus.ERROR, t.getMessage(), t);
}
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class SWTResourcesPage method refresh.
/**
* Refreshes the appearance.
*
* @param force <tt>true</tt> to force refresh
*/
protected void refresh(final boolean force) {
final boolean isVisible = isVisible();
new RefreshJob(NLS.bind(Messages.refreshMemorySectionJobLabel, section.getJvm().getPid()), toString()) {
@Override
protected void refreshModel(IProgressMonitor monitor) {
try {
IActiveJvm jvm = section.getJvm();
if (isVisible && jvm != null && jvm.isConnected() && (!section.isRefreshSuspended() || force) && jvm.getSWTResourceMonitor().isSupported()) {
jvm.getSWTResourceMonitor().refreshResourcesCache();
}
} catch (JvmCoreException e) {
Activator.log(Messages.refreshHeapDataFailedMsg, e);
}
}
@Override
protected void refreshUI() {
IActiveJvm jvm = section.getJvm();
boolean isConnected = jvm != null && jvm.isConnected();
if (!isDisposed()) {
refreshBackground();
}
refreshAction.setEnabled(isConnected);
clearSWTResourceAction.setEnabled(isConnected);
if (!force && section.isRefreshSuspended() || !isVisible) {
return;
}
TreeViewer resourceViewer = resourceFilteredTree.getViewer();
if (!resourceViewer.getControl().isDisposed()) {
resourceViewer.refresh();
if (jvm != null) {
resourceFilteredTree.updateStatusLine(jvm.getSWTResourceMonitor().getResources());
}
// select the first item if no item is selected
if (resourceViewer.getSelection().isEmpty()) {
TreeItem[] items = resourceViewer.getTree().getItems();
if (items != null && items.length > 0) {
resourceViewer.getTree().select(items[0]);
stackTraceViewer.setInput(resourceViewer.getSelection());
} else {
stackTraceViewer.setInput(null);
}
}
}
if (!stackTraceViewer.getControl().isDisposed()) {
stackTraceViewer.refresh();
}
}
}.schedule();
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class ConfigureChartAction method performConfiguration.
/**
* Performs the configuration.
*
* @param chartTitle The chart title
* @param axisUnit The axis unit
* @param attributes The attributes
* @param removedAttributes The removed attributes
*/
private void performConfiguration(String chartTitle, AxisUnit axisUnit, List<MBeanAttribute> attributes, List<MBeanAttribute> removedAttributes) {
IMonitoredMXBeanGroup group = chart.getAttributeGroup();
group.setName(chartTitle);
group.setAxisUnit(axisUnit);
for (MBeanAttribute attribute : attributes) {
ObjectName objectName = attribute.getObjectName();
String attributeName = attribute.getAttributeName();
IMonitoredMXBeanAttribute monitoredAttribute = group.getAttribute(objectName, attributeName);
RGB rgb = attribute.getRgb();
if (monitoredAttribute == null) {
try {
group.addAttribute(objectName.getCanonicalName(), attributeName, new int[] { rgb.red, rgb.green, rgb.blue });
} catch (JvmCoreException e) {
Activator.log(Messages.addAttributeFailedMsg, e);
}
} else {
monitoredAttribute.setRGB(rgb.red, rgb.green, rgb.blue);
}
}
for (MBeanAttribute removedAttribute : removedAttributes) {
group.removeAttribute(removedAttribute.getObjectName().getCanonicalName(), removedAttribute.getAttributeName());
}
chart.refresh();
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class NewChartAction method performNew.
/**
* Performs creating a new chart.
*
* @param chartTitle The chart title
* @param axisUnit The axis unit
* @param attributes The attributes
* @param jvm The jvm
*/
private static void performNew(String chartTitle, AxisUnit axisUnit, List<MBeanAttribute> attributes, IActiveJvm jvm) {
IMonitoredMXBeanGroup group = jvm.getMBeanServer().addMonitoredAttributeGroup(chartTitle, axisUnit);
for (MBeanAttribute attribute : attributes) {
ObjectName objectName = attribute.getObjectName();
String attributeName = attribute.getAttributeName();
RGB rgb = attribute.getRgb();
try {
group.addAttribute(objectName.getCanonicalName(), attributeName, new int[] { rgb.red, rgb.green, rgb.blue });
} catch (JvmCoreException e) {
Activator.log(Messages.addAttributeFailedMsg, e);
}
}
}
Aggregations