Search in sources :

Example 11 with JvmModelEvent

use of org.talend.designer.runtime.visualization.JvmModelEvent 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)

Example 12 with JvmModelEvent

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

the class MBeanNotification method unsubscribe.

/*
     * @see IMBeanNotification#unsubscribe(ObjectName)
     */
@Override
public void unsubscribe(ObjectName objectName) throws JvmCoreException {
    NotificationListener listener = listeners.get(objectName);
    activeJvm.getMBeanServer().removeNotificationListener(objectName, listener);
    listeners.remove(objectName);
    notifications.remove(objectName);
    JvmModel.getInstance().fireJvmModelChangeEvent(new JvmModelEvent(State.JvmModified, activeJvm));
}
Also used : JvmModelEvent(org.talend.designer.runtime.visualization.JvmModelEvent) NotificationListener(javax.management.NotificationListener)

Example 13 with JvmModelEvent

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

the class ActiveJvm method connect.

/*
     * @see IActiveJvm#connect(int)
     */
@Override
public void connect(int updatePeriod) throws JvmCoreException {
    if (!isAttachSupported) {
        throw new IllegalStateException(Messages.attachNotSupportedMsg);
    }
    mBeanServer.connect(updatePeriod);
    isConnected = true;
    if (!isRemote) {
        JvmModel.getInstance().getAgentLoadHandler().loadAgent(this);
    }
    if (swtResourceMonitor.isSupported()) {
        swtResourceMonitor.setTracking(true);
    }
    JvmModel.getInstance().fireJvmModelChangeEvent(new JvmModelEvent(State.JvmConnected, this));
}
Also used : JvmModelEvent(org.talend.designer.runtime.visualization.JvmModelEvent)

Aggregations

JvmModelEvent (org.talend.designer.runtime.visualization.JvmModelEvent)13 JvmCoreException (org.talend.designer.runtime.visualization.JvmCoreException)5 Date (java.util.Date)3 CoreException (org.eclipse.core.runtime.CoreException)3 IOException (java.io.IOException)2 OutputStream (java.io.OutputStream)2 Notification (javax.management.Notification)2 NotificationListener (javax.management.NotificationListener)2 IFileStore (org.eclipse.core.filesystem.IFileStore)2 IActiveJvm (org.talend.designer.runtime.visualization.IActiveJvm)2 IMBeanNotification (org.talend.designer.runtime.visualization.MBean.IMBeanNotification)2 File (java.io.File)1 ObjectName (javax.management.ObjectName)1 IPath (org.eclipse.core.runtime.IPath)1 IHost (org.talend.designer.runtime.visualization.IHost)1 ITerminatedJvm (org.talend.designer.runtime.visualization.ITerminatedJvm)1 IMonitoredMXBeanAttribute (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanAttribute)1 IMonitoredMXBeanGroup (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup)1 AbstractJvm (org.talend.designer.runtime.visualization.internal.core.AbstractJvm)1 Host (org.talend.designer.runtime.visualization.internal.core.Host)1