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;
}
}
}
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));
}
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));
}
Aggregations