use of org.talend.designer.runtime.visualization.JvmModel in project tdi-studio-se by Talend.
the class MemoryRuntimeComposite method initCurrentActiveJobJvm.
private boolean initCurrentActiveJobJvm() {
boolean isJvmFound = false;
JvmModel jvmModel = JvmModel.getInstance();
if (isRemoteRun) {
if (isRemoteMonitoring && remotePort != -1) {
try {
if (currentJvm == null) {
currentJvm = jvmModel.addRemoteHostAndJvm(remoteHost, remotePort);
return true;
}
if (remotePort == currentJvm.getPort() && currentJvm.isConnected()) {
return true;
}
if (currentJvm.isConnected()) {
currentJvm.disconnect();
}
currentJvm = jvmModel.addRemoteHostAndJvm(remoteHost, remotePort);
return true;
} catch (JvmCoreException e) {
ExceptionHandler.process(e);
return false;
}
}
} else {
String jobClassName = JavaResourcesHelper.getJobClassName(processContext.getProcess());
List<IActiveJvm> activateJvms = jvmModel.getHost(IHost.LOCALHOST).getActiveJvms();
for (IActiveJvm jvm : activateJvms) {
String activeJvmClassName = jvm.getMainClass();
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
System.out.println("target:[" + jobClassName + "],loop item[" + activeJvmClassName + "]");
if (activeJvmClassName != null) {
activeJvmClassName = activeJvmClassName.trim();
}
if (activeJvmClassName.equals(jobClassName)) {
currentJvm = jvm;
isJvmFound = true;
break;
}
}
}
return isJvmFound;
}
Aggregations