@Override protected IStatus run(IProgressMonitor monitor) { try { final Socket socket = serverSocket.accept(); writer = new RemoteControlWriter(socket.getOutputStream()); final RemoteControlReader reader = new RemoteControlReader(socket.getInputStream()); while (true) { final MemoryExecutionDataSource memory = new MemoryExecutionDataSource(); memory.readFrom(reader); if (memory.isEmpty()) { return Status.OK_STATUS; } dataReceived = true; final CoverageSession session = new CoverageSession( createDescription(), launch.getScope(), files.newFile(memory), launch.getLaunchConfiguration()); sessionManager.addSession(session, preferences.getActivateNewSessions(), launch); } } catch (IOException e) { return EclEmmaStatus.EXECDATA_DUMP_ERROR.getStatus(e); } catch (CoreException e) { return e.getStatus(); } }
private String createDescription() { final Object[] args = new Object[] {launch.getLaunchConfiguration().getName(), new Date()}; return MessageFormat.format(CoreMessages.LaunchSessionDescription_value, args); }