use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class TimelineSection method jvmModelChanged.
/*
* @see AbstractJvmPropertySection#jvmModelChanged(JvmModelEvent)
*/
@Override
public void jvmModelChanged(JvmModelEvent event) {
super.jvmModelChanged(event);
if (event.state == State.JvmConnected && !chartsPage.isDisposed()) {
final IActiveJvm newJvm = (IActiveJvm) event.jvm;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
reconstructCharts(newJvm, true);
}
});
newJvm.getMBeanServer().addServerChangeListener(mBeanServerChangeListener);
}
}
use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class TimelineSection method refreshReportField.
/**
* Refreshes the report field.
*/
private void refreshReportField() {
IActiveJvm jvm = getJvm();
List<IMonitoredMXBeanGroup> groups = jvm.getMBeanServer().getMonitoredAttributeGroups();
for (IMonitoredMXBeanGroup group : groups) {
if (group.getName().equals(MonitorAttributeName.HEAP_MEMORY)) {
Number useHeapSize = 0;
Number maxHeapSize = 0;
Date lastDate = null;
for (IMonitoredMXBeanAttribute attribute : group.getAttributes()) {
if (attribute.getAttributeName().equals(MonitorAttributeName.HEAP_MEMORY_USE)) {
List<Number> values = attribute.getValues();
List<Date> dates = attribute.getDates();
if (values.size() > 1) {
useHeapSize = values.get(values.size() - 1);
lastDate = dates.get(dates.size() - 1);
}
} else {
List<Number> values = attribute.getValues();
List<Date> dates = attribute.getDates();
if (values.size() > 1) {
maxHeapSize = values.get(values.size() - 1);
lastDate = dates.get(dates.size() - 1);
}
}
}
if (lastDate != null) {
if (isRightPercentage(maxHeapSize, useHeapSize)) {
setNormalReport(lastDate);
} else {
setWarningReport(lastDate);
}
}
// Number diff = getDiff(maxHeapSize, useHeapSize);
// if (diff instanceof Integer) {
// int value = diff.intValue();
// if (value <= 200) {
// setWarningReport(lastDate);
// } else {
// setNormalReport(lastDate);
// }
// } else if (diff instanceof Long) {
// long value = diff.longValue();
// if (value <= 200) {
// setWarningReport(lastDate);
// } else {
// setNormalReport(lastDate);
// }
// } else if (diff instanceof Double) {
// double value = diff.doubleValue();
// if (value <= 200) {
// setWarningReport(lastDate);
// } else {
// setNormalReport(lastDate);
// }
// }
}
}
}
use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class MemoryRuntimeComposite method initMonitoringModel.
private void initMonitoringModel() {
final List<IActiveJvm> contructSelections = new ArrayList<IActiveJvm>();
contructSelections.add(currentJvm);
if (currentJvm != null) {
viewPart.getSite().setSelectionProvider(new ProcessViewSelectionProvider(new StructuredSelection(contructSelections)));
}
}
use of org.talend.designer.runtime.visualization.IActiveJvm 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.IActiveJvm in project tdi-studio-se by Talend.
the class MBeansSection method refresh.
/*
* @see AbstractPropertySection#refresh()
*/
@Override
public void refresh() {
if (!isSectionActivated) {
return;
}
IActiveJvm jvm = getJvm();
boolean isConnected = jvm != null && jvm.isConnected();
refreshAction.setEnabled(isConnected);
if (sashForm != null && !sashForm.isDisposed()) {
refreshBackground(sashForm.getChildren(), isConnected);
sashForm.refresh();
}
}
Aggregations