Search in sources :

Example 41 with IActiveJvm

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);
    }
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) Notification(javax.management.Notification)

Example 42 with IActiveJvm

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() + "]";
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Example 43 with IActiveJvm

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);
        }
    }
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm)

Example 44 with IActiveJvm

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();
}
Also used : RefreshJob(org.talend.designer.runtime.visualization.internal.ui.RefreshJob) IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) TreeViewer(org.eclipse.jface.viewers.TreeViewer) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 45 with IActiveJvm

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;
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) RuntimeMXBean(java.lang.management.RuntimeMXBean) OperatingSystemMXBean(java.lang.management.OperatingSystemMXBean)

Aggregations

IActiveJvm (org.talend.designer.runtime.visualization.IActiveJvm)54 JvmCoreException (org.talend.designer.runtime.visualization.JvmCoreException)14 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)7 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)6 RefreshJob (org.talend.designer.runtime.visualization.internal.ui.RefreshJob)6 IMonitoredMXBeanGroup (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup)5 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 ObjectName (javax.management.ObjectName)2 Job (org.eclipse.core.runtime.jobs.Job)2 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 Composite (org.eclipse.swt.widgets.Composite)2 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)2 IHost (org.talend.designer.runtime.visualization.IHost)2 JvmModelEvent (org.talend.designer.runtime.visualization.JvmModelEvent)2 IMBeanServerChangeListener (org.talend.designer.runtime.visualization.MBean.IMBeanServerChangeListener)2 IMonitoredMXBeanAttribute (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanAttribute)2 AxisUnit (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup.AxisUnit)2 MBeanServerEvent (org.talend.designer.runtime.visualization.MBean.MBeanServerEvent)2