use of org.jboss.ide.eclipse.as.core.util.ClassCollectingHCRListener in project jbosstools-openshift by jbosstools.
the class OpenShiftLaunchController method getHotCodeReplaceListener.
protected IJavaHotCodeReplaceListener getHotCodeReplaceListener(final IServer server, final ILaunch launch) {
return new ClassCollectingHCRListener(server, launch) {
protected void prePublish(IJavaDebugTarget target, IModule[] modules) {
try {
getLaunch().terminate();
} catch (DebugException de) {
OpenShiftCoreActivator.pluginLog().logError(toCoreException("Unable to terminate debug session", de));
}
}
@Override
protected void postPublish(IJavaDebugTarget target, IModule[] modules) {
IServer server = getServer();
waitModulesStarted(modules);
executeJMXGarbageCollection(server, modules);
sleep(3000);
String portAttr = launch.getAttribute(LAUNCH_DEBUG_PORT_PROP);
int port = DebugContext.NO_DEBUG_PORT;
try {
port = Integer.parseInt(portAttr);
} catch (NumberFormatException nfe) {
// TODO
}
try {
ILaunch newLaunch = attachRemoteDebugger(server, port, new NullProgressMonitor());
if (newLaunch != null) {
overrideHotcodeReplace(server, newLaunch);
}
setLaunch(newLaunch);
} catch (CoreException ce) {
OpenShiftCoreActivator.pluginLog().logError(toCoreException("Unable to restart debug session", ce));
}
}
};
}
Aggregations