fWaitForConnectionJob = new WaitForConnectionJob(connector,arguments); fWaitForConnectionJob.setPriority(Job.SHORT); fWaitForConnectionJob.setSystem(true); fWaitForConnectionJob.addJobChangeListener(new JobChangeAdapter(){ @Override public void running(IJobChangeEvent event) { fWaitForConnectionJob.schedule();
String vmLabel = constructVMLabel(vm, portArg.value(), fLaunch.getLaunchConfiguration()); IDebugTarget debugTarget= JDIDebugModel.newDebugTarget(fLaunch, vm, vmLabel, null, allowTerminate, true); fLaunch.addDebugTarget(debugTarget);
String vmLabel = constructVMLabel(vm, portArg.value(), fLaunch.getLaunchConfiguration()); IDebugTarget debugTarget= JDIDebugModel.newDebugTarget(fLaunch, vm, vmLabel, null, allowTerminate, true); fLaunch.addDebugTarget(debugTarget); } finally { stopListening();
throw new CoreException(getStatus(LaunchingMessages.SocketListenConnectorProcess_0, null, IJavaLaunchConfigurationConstants.ERR_REMOTE_VM_CONNECTION_FAILED)); fWaitForConnectionJob = new WaitForConnectionJob(this,connector,arguments); fWaitForConnectionJob.setPriority(Job.SHORT); fWaitForConnectionJob.addJobChangeListener(new JobChangeAdapter(){ @Override public void running(IJobChangeEvent event) { fWaitForConnectionJob.schedule();
/** * Tells the listening connector to stop listening. Ensures * that the socket is closed and the port released. Sets a flag * so that the IOException thrown by the connector's accept method * will be ignored. */ protected void stopListening() { if (!fListeningStopped){ try{ fListeningStopped = true; fConnector.stopListening(fArguments); } catch (IOException e) { done(getStatus(LaunchingMessages.SocketListenConnectorProcess_5, e, IJavaLaunchConfigurationConstants.ERR_REMOTE_VM_CONNECTION_FAILED)); } catch (IllegalConnectorArgumentsException e) { done(getStatus(LaunchingMessages.SocketListenConnectorProcess_5, e, IJavaLaunchConfigurationConstants.ERR_REMOTE_VM_CONNECTION_FAILED)); } } }
/** * Tells the listening connector to stop listening. Ensures * that the socket is closed and the port released. Sets a flag * so that the IOException thrown by the connector's accept method * will be ignored. */ protected void stopListening() { if (!fListeningStopped){ try{ fListeningStopped = true; fConnector.stopListening(fArguments); } catch (IOException e) { done(getStatus(LaunchingMessages.SocketListenConnectorProcess_5, e, IJavaLaunchConfigurationConstants.ERR_REMOTE_VM_CONNECTION_FAILED)); } catch (IllegalConnectorArgumentsException e) { done(getStatus(LaunchingMessages.SocketListenConnectorProcess_5, e, IJavaLaunchConfigurationConstants.ERR_REMOTE_VM_CONNECTION_FAILED)); } } }
@Override protected void canceling() { stopListening(); }
@Override protected void canceling() { stopListening(); }
@Override public void terminate() throws DebugException { if (!fTerminated){ fTerminated = true; if (fWaitForConnectionJob != null){ fWaitForConnectionJob.cancel(); fWaitForConnectionJob.stopListening(); fWaitForConnectionJob = null; } fireTerminateEvent(); } }
@Override public void done(IJobChangeEvent event) { if (event.getResult().isOK() && continueListening()) { fWaitForConnectionJob.schedule(); } else { try{ terminate(); } catch (DebugException e){} } } });
@Override public void terminate() throws DebugException { if (!fTerminated){ fTerminated = true; fLaunch.removeProcess(this); if (fWaitForConnectionJob != null){ fWaitForConnectionJob.cancel(); fWaitForConnectionJob.stopListening(); fWaitForConnectionJob = null; } fireTerminateEvent(); } }