use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class RuntimeGraphcsComposite method refreshReportField.
private void refreshReportField() {
long newAddTime = System.currentTimeMillis();
if (newAddTime - lastAddTime < 10 * 1000) {
return;
}
lastAddTime = newAddTime;
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 if (attribute.getAttributeName().equals(MonitorAttributeName.HEAP_MEMORY_SIZE)) {
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);
}
}
}
}
}
use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class NewJvmConnectionWizard method addActiveJvm.
/**
* Adds the active JVM.
*
* @return The active JVM
*/
private IActiveJvm addActiveJvm() {
final boolean isHostAndPortSelected = page.isHostAndPortSelected();
final String hostName = page.getRemoteHost();
final int port = page.getPort();
final String userName = page.getUserName();
final String password = page.getPassword();
final String jmxUrl = page.getJmxUrl();
try {
final IActiveJvm[] result = new IActiveJvm[1];
IRunnableWithProgress op = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
int period = Activator.getDefault().getPreferenceStore().getInt(IConstants.UPDATE_PERIOD);
if (isHostAndPortSelected) {
IHost host = JvmModel.getInstance().addHost(hostName);
result[0] = host.addRemoteActiveJvm(port, userName, password, period);
} else {
result[0] = JvmModel.getInstance().addHostAndJvm(jmxUrl, userName, password, period);
}
} catch (JvmCoreException e) {
throw new InvocationTargetException(e);
}
}
};
new ProgressMonitorDialog(getShell()).run(true, true, op);
return result[0];
} catch (InvocationTargetException e) {
openErrorDialog(e);
return null;
} catch (InterruptedException e) {
return null;
}
}
use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class NewJvmConnectionWizard method performFinish.
/*
* @see Wizard#performFinish()
*/
@Override
public boolean performFinish() {
// add active JVM
IActiveJvm jvm = addActiveJvm();
if (jvm == null) {
return false;
}
// select item on JVM explorer
viewer.refresh();
viewer.setSelection(new StructuredSelection(jvm));
// connect to JVM
try {
int period = Activator.getDefault().getPreferenceStore().getInt(IConstants.UPDATE_PERIOD);
jvm.connect(period);
} catch (JvmCoreException e) {
Activator.log(NLS.bind(Messages.connectJvmFailedMsg, jvm.getPid()), e);
}
page.storeDialogSettings();
return true;
}
use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class NewChartAction method run.
/*
* @see Action#run()
*/
@Override
public void run() {
IActiveJvm jvm = section.getJvm();
if (jvm == null) {
return;
}
NewChartDialog dialog = new NewChartDialog(Display.getDefault().getActiveShell(), jvm);
if (dialog.open() == Window.OK) {
performNew(dialog.getChartTitle(), dialog.getAxisUnit(), dialog.getAttributes(), jvm);
}
}
use of org.talend.designer.runtime.visualization.IActiveJvm 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);
}
}
}
Aggregations