use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class ConfigChartAction 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 LoadChartAction method loadChartSet.
/**
* Loads the given chart set.
*
* @param chartSet The chart set
* @throws JvmCoreException
*/
private void loadChartSet(String chartSet) throws JvmCoreException {
loadPredefinedChartSet(chartSet);
IMemento chartSetsMemento;
try {
chartSetsMemento = getChartSetsMemento();
} catch (WorkbenchException e) {
throw new JvmCoreException(IStatus.ERROR, Messages.loadChartSetFailedMsg, e);
} catch (IOException e) {
throw new JvmCoreException(IStatus.ERROR, Messages.loadChartSetFailedMsg, e);
}
if (chartSetsMemento == null) {
return;
}
IMemento[] mementos = chartSetsMemento.getChildren(CHART_SET);
for (IMemento memento : mementos) {
if (chartSet.equals(memento.getID())) {
loadChartSet(memento);
return;
}
}
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class LoadChartSetAction method loadChartSet.
/**
* Loads the given chart set.
*
* @param chartSet The chart set
* @throws JvmCoreException
*/
private void loadChartSet(String chartSet) throws JvmCoreException {
loadPredefinedChartSet(chartSet);
IMemento chartSetsMemento;
try {
chartSetsMemento = getChartSetsMemento();
} catch (WorkbenchException e) {
throw new JvmCoreException(IStatus.ERROR, Messages.loadChartSetFailedMsg, e);
} catch (IOException e) {
throw new JvmCoreException(IStatus.ERROR, Messages.loadChartSetFailedMsg, e);
}
if (chartSetsMemento == null) {
return;
}
IMemento[] mementos = chartSetsMemento.getChildren(CHART_SET);
for (IMemento memento : mementos) {
if (chartSet.equals(memento.getID())) {
loadChartSet(memento);
return;
}
}
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class MemoryRuntimeComposite method initCurrentActiveJobJvm.
private boolean initCurrentActiveJobJvm() {
boolean isJvmFound = false;
JvmModel jvmModel = JvmModel.getInstance();
if (isRemoteRun) {
if (isRemoteMonitoring && remotePort != -1) {
try {
if (currentJvm == null) {
currentJvm = jvmModel.addRemoteHostAndJvm(remoteHost, remotePort);
return true;
}
if (remotePort == currentJvm.getPort() && currentJvm.isConnected()) {
return true;
}
if (currentJvm.isConnected()) {
currentJvm.disconnect();
}
currentJvm = jvmModel.addRemoteHostAndJvm(remoteHost, remotePort);
return true;
} catch (JvmCoreException e) {
ExceptionHandler.process(e);
return false;
}
}
} else {
String jobClassName = JavaResourcesHelper.getJobClassName(processContext.getProcess());
List<IActiveJvm> activateJvms = jvmModel.getHost(IHost.LOCALHOST).getActiveJvms();
for (IActiveJvm jvm : activateJvms) {
String activeJvmClassName = jvm.getMainClass();
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
System.out.println("target:[" + jobClassName + "],loop item[" + activeJvmClassName + "]");
if (activeJvmClassName != null) {
activeJvmClassName = activeJvmClassName.trim();
}
if (activeJvmClassName.equals(jobClassName)) {
currentJvm = jvm;
isJvmFound = true;
break;
}
}
}
return isJvmFound;
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class ConfigureCpuProfilerAction method run.
/*
* @see Action#run()
*/
@Override
public void run() {
// get the profiled packages
final Job getProfiledPackagesJob = new Job(Messages.getProfiledPackagesJobLabel) {
@Override
protected IStatus run(IProgressMonitor monitor) {
IActiveJvm jvm = cpuSection.getJvm();
if (jvm == null) {
return Status.CANCEL_STATUS;
}
try {
packages = jvm.getCpuProfiler().getProfiledPackages();
} catch (JvmCoreException e) {
Activator.log(Messages.getProfiledPackagesFailedMsg, e);
}
return Status.OK_STATUS;
}
};
getProfiledPackagesJob.schedule();
// open CPU profiler configuration dialog
Job openDialogJob = new Job(Messages.openDialogJobLabel) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
getProfiledPackagesJob.join();
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
openDialog();
}
});
} catch (InterruptedException e) {
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}
};
openDialogJob.schedule();
}
Aggregations