use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class NotificationFilteredTree method setInput.
/**
* Sets the input.
*
* @param objectName The object name
*/
public void setInput(ObjectName objectName) {
IActiveJvm jvm = section.getJvm();
if (objectName == null || jvm == null) {
treeViewer.setInput(null);
return;
}
Notification[] notifications = jvm.getMBeanServer().getMBeanNotification().getNotifications(objectName);
if (!isSameInput(notifications)) {
treeViewer.setInput(notifications);
}
}
use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class TitleProvider method getText.
/*
* @see LabelProvider#getText(Object)
*/
@Override
public String getText(Object element) {
if (!(element instanceof StructuredSelection)) {
return super.getText(element);
}
Object firstElement = ((StructuredSelection) element).getFirstElement();
if (!(firstElement instanceof IActiveJvm)) {
return super.getText(element);
}
IActiveJvm jvm = (IActiveJvm) firstElement;
//$NON-NLS-1$ //$NON-NLS-2$
return jvm.getMainClass() + " [PID: " + jvm.getPid() + "]";
}
use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class JvmAttachHandler method updatesActiveJvms.
/**
* Updates the active JVMs.
*
* @throws JvmCoreException
*/
void updatesActiveJvms() throws JvmCoreException {
Object monitoredHost = Tools.getInstance().invokeGetMonitoredHost(IHost.LOCALHOST);
Set<Integer> activeJvms = Tools.getInstance().invokeActiveVms(monitoredHost);
// add JVMs
List<IActiveJvm> previousVms = localhost.getActiveJvms();
for (int pid : activeJvms) {
if (containJvm(previousVms, pid)) {
continue;
}
addActiveJvm(pid, monitoredHost);
}
// remove JVMs
for (IActiveJvm jvm : previousVms) {
Integer pid = jvm.getPid();
if (!activeJvms.contains(pid)) {
localhost.removeJvm(pid);
}
}
}
use of org.talend.designer.runtime.visualization.IActiveJvm 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.IActiveJvm in project tdi-studio-se by Talend.
the class HeapHistogramPage method isSupported.
/**
* Gets the state indicating if heap histogram is supported.
* <p>
* WORKAROUND: Heap histogram is disabled on 64bit OS when monitoring eclipse itself, due to the issue that the
* method heapHisto() of the class HotSpotVirtualMachine causes continuously increasing the committed heap memory.
*
* @return <tt>true</tt> if heap histogram is supported
*/
boolean isSupported() {
IActiveJvm jvm = section.getJvm();
if (jvm == null) {
return false;
}
OperatingSystemMXBean osMBean = ManagementFactory.getOperatingSystemMXBean();
RuntimeMXBean runtimeMBean = ManagementFactory.getRuntimeMXBean();
if (osMBean.getArch().contains(ARCH_64BIT) && runtimeMBean.getName().contains(String.valueOf(jvm.getPid()))) {
return false;
}
return true;
}
Aggregations