use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class TimelineSection method reconstructCharts.
/**
* Reconstructs charts.
* <p>
* When JVM gets connected (e.g. opening Properties view or on already opened Properties view), the default chart
* set will be loaded and applied.
* <p>
* When target JVM is already connected (e.g. opening new Properties view, another JVM gets selected, or monitored
* attributes gets changed), chart configuration will be adapted to the monitored attributes stored in the target
* JVM.
*
* @param activeJvm The JVM
* @param connected True if JVM gets connected
*/
void reconstructCharts(IActiveJvm activeJvm, boolean connected) {
if (chartsPage.isDisposed()) {
return;
}
if (connected) {
try {
loadChartSetAction.loadDefaultChartSet();
} catch (JvmCoreException e) {
Activator.log(Messages.configureMonitoredAttributesFailedMsg, e);
}
}
List<IMonitoredMXBeanGroup> groups = activeJvm.getMBeanServer().getMonitoredAttributeGroups();
if (groups.size() == 0) {
timelinePageBook.showPage(messagePage);
return;
}
timelinePageBook.showPage(chartsPage);
chartsPage.setVisible(false);
for (TimelineChart chart : charts) {
chart.dispose();
}
charts.clear();
if (reportComposite != null && !reportComposite.isDisposed()) {
reportComposite.dispose();
}
GridLayout layout = (GridLayout) chartsPage.getLayout();
layout.numColumns = (groups.size() > 1) ? 2 : 1;
chartsPage.setLayout(layout);
for (IMonitoredMXBeanGroup group : groups) {
if (group.getName().equals(MonitorAttributeName.HEAP_MEMORY)) {
createSection(chartsPage, group);
break;
}
}
createReportField();
for (IMonitoredMXBeanGroup group : groups) {
if (!group.getName().equals(MonitorAttributeName.HEAP_MEMORY)) {
createSection(chartsPage, group);
}
}
chartsPage.layout();
chartsPage.setVisible(true);
refresh();
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class TimelineSection method createMessagePage.
/**
* Creates the message page.
*
* @return The message page
*/
private Composite createMessagePage() {
messagePage = new Composite(timelinePageBook, SWT.NONE);
messagePage.setLayout(new GridLayout(3, false));
messagePage.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
FormToolkit toolkit = new FormToolkit(Display.getDefault());
Hyperlink hyperlink = toolkit.createHyperlink(messagePage, Messages.loadDefaultChartSetLabel, SWT.NONE);
hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent event) {
try {
new LoadChartSetAction(TimelineSection.this).loadDefaultChartSet();
} catch (JvmCoreException e) {
Activator.log(Messages.loadChartSetFailedMsg, e);
}
}
});
return messagePage;
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class MemoryRuntimeComposite method doScheduledGc.
protected void doScheduledGc(int interval) {
timer.cancel();
if (interval == 0) {
return;
}
timer = null;
timer = new Timer();
TimerTask gcTask = new TimerTask() {
@Override
public void run() {
if (processContext != null && processContext.isRunning()) {
if (currentJvm != null) {
try {
currentJvm.getMBeanServer().runGarbageCollector();
//$NON-NLS-1$ //$NON-NLS-2$
System.out.println("GC executed at " + TalendDate.getDate("HH:mm:ss"));
} catch (JvmCoreException e) {
//do nothing.
}
}
} else {
timer.cancel();
//$NON-NLS-1$ //$NON-NLS-2$
System.out.println("timer cancelled at " + TalendDate.getDate("HH:mm:ss"));
}
}
};
timer.schedule(gcTask, interval * 1000, interval * 1000);
}
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);
}
}
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class Host method saveHostProperties.
/**
* Saves the properties.
*/
private void saveHostProperties() {
Properties props = new Properties();
IPath hostDir;
try {
hostDir = getHostDir();
} catch (JvmCoreException e) {
Activator.log(IStatus.ERROR, Messages.savePropertiesFileFailedMsg, e);
return;
}
IFileStore fileStore = Util.getFileStore(Host.PROPERTIES_FILE, hostDir);
OutputStream os = null;
try {
os = fileStore.openOutputStream(EFS.NONE, null);
props.setProperty(Host.HOST_PROP_KEY, hostName);
//$NON-NLS-1$
props.storeToXML(os, "Host Properties");
} catch (CoreException e) {
Activator.log(IStatus.ERROR, NLS.bind(Messages.openOutputStreamFailedMsg, fileStore.toURI().getPath()), e);
} catch (IOException e) {
try {
fileStore.delete(EFS.NONE, null);
} catch (CoreException e1) {
// do nothing
}
Activator.log(IStatus.ERROR, NLS.bind(Messages.writePropertiesFileFailedMsg, fileStore.toURI().getPath()), e);
} finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
// do nothing
}
}
}
}
Aggregations