Search in sources :

Example 36 with IActiveJvm

use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.

the class DumpCpuProfilingDataAction method performRun.

/*
     * @see AbstractJobAction#performRun(IProgressMonitor)
     */
@Override
protected IStatus performRun(IProgressMonitor monitor) {
    IActiveJvm jvm = section.getJvm();
    if (jvm == null) {
        return Status.CANCEL_STATUS;
    }
    IFileStore fileStore = null;
    try {
        fileStore = jvm.getCpuProfiler().dump();
    } catch (JvmCoreException e) {
        Activator.log(Messages.dumpCpuProfileDataFailedMsg, e);
        return Status.CANCEL_STATUS;
    }
    section.setPinned(true);
    OpenSnapshotAction.openEditor(fileStore);
    return Status.OK_STATUS;
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) IFileStore(org.eclipse.core.filesystem.IFileStore) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 37 with IActiveJvm

use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.

the class AbstractJvmPropertySection method setInput.

/*
     * @see AbstractPropertySection#setInput(IWorkbenchPart, ISelection)
     */
@Override
public final void setInput(IWorkbenchPart part, ISelection selection) {
    super.setInput(part, selection);
    if (!(selection instanceof StructuredSelection)) {
        return;
    }
    StructuredSelection structuredSelection = (StructuredSelection) selection;
    Object firstElement = structuredSelection.getFirstElement();
    if (!(firstElement instanceof IActiveJvm)) {
        super.setInput(part, null);
        return;
    }
    IActiveJvm oldJvm = jvm;
    IActiveJvm newJvm = (IActiveJvm) firstElement;
    jvm = newJvm;
    if (oldJvm != newJvm || newJvm.isConnected()) {
        updatePage();
    }
    addToolBarActions();
    addLocalMenus();
    if (newJvm.isConnected()) {
        activateSection();
    }
    setInput(part, selection, newJvm, oldJvm);
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Example 38 with IActiveJvm

use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.

the class Host method addActiveJvm.

/**
     * Adds the active JVM.
     * 
     * @param jvm The active JVM.
     * @return The active JVM
     */
protected IActiveJvm addActiveJvm(IActiveJvm jvm) {
    for (IActiveJvm activeJvm : activeJvms) {
        if (activeJvm.getPid() == jvm.getPid()) {
            return jvm;
        }
    }
    activeJvms.add(jvm);
    JvmModel.getInstance().fireJvmModelChangeEvent(new JvmModelEvent(State.JvmAdded, jvm));
    return jvm;
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) JvmModelEvent(org.talend.designer.runtime.visualization.JvmModelEvent)

Example 39 with IActiveJvm

use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.

the class Host method addLocalActiveJvm.

/*
     * @see IHost#addLocalActiveJvm(int, String, String, String)
     */
@Override
public IActiveJvm addLocalActiveJvm(int pid, String mainClass, String url, String errorStateMessage) throws JvmCoreException {
    for (IActiveJvm jvm : getActiveJvms()) {
        if (jvm.getPid() == pid) {
            return jvm;
        }
    }
    ActiveJvm jvm = new ActiveJvm(pid, url, this);
    jvm.setMainClass(mainClass);
    jvm.setErrorStateMessage(errorStateMessage);
    return addActiveJvm(jvm);
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm)

Example 40 with IActiveJvm

use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.

the class Host method removeJvm.

/*
     * @see IHost#removeJvm(int)
     */
@Override
public void removeJvm(int pid) {
    IPath hostDir = null;
    try {
        hostDir = getHostDir();
    } catch (JvmCoreException e) {
        Activator.log(IStatus.ERROR, NLS.bind(Messages.removeJvmFailedMsg, +pid), e);
        return;
    }
    for (ITerminatedJvm jvm : terminatedJvms) {
        if (jvm.getPid() == pid) {
            terminatedJvms.remove(jvm);
            int id = (jvm.getPid() != -1) ? jvm.getPid() : jvm.getPort();
            IPath dirPath = hostDir.append(File.separator + id + IJvm.DIR_SUFFIX);
            Util.deleteDir(dirPath.toFile());
            JvmModel.getInstance().fireJvmModelChangeEvent(new JvmModelEvent(State.JvmRemoved, null));
            break;
        }
    }
    for (IActiveJvm jvm : activeJvms) {
        if (jvm.getPid() == pid) {
            if (jvm.isConnected()) {
                jvm.disconnect();
            }
            if (jvm.getShapshots().size() > 0) {
                addTerminatedJvm(jvm.getPid(), -1, jvm.getMainClass());
            } else {
                int id = (jvm.getPid() != -1) ? jvm.getPid() : jvm.getPort();
                IPath dirPath = hostDir.append(File.separator + id + IJvm.DIR_SUFFIX);
                Util.deleteDir(dirPath.toFile());
            }
            activeJvms.remove(jvm);
            JvmModel.getInstance().fireJvmModelChangeEvent(new JvmModelEvent(State.JvmRemoved, null));
            break;
        }
    }
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) IPath(org.eclipse.core.runtime.IPath) ITerminatedJvm(org.talend.designer.runtime.visualization.ITerminatedJvm) JvmModelEvent(org.talend.designer.runtime.visualization.JvmModelEvent) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

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