java -javaagent:$PWD/coverage/jacocoagent.jar=output=tcpclient,destfile=$PWD/jacoco-server.exec,includes=*,address=1XX.XX.XX.XX,port=6300
public final class ExecutionDataServer {
private static String DESTFILE = "jacoco-server.exec";
private static String ADDRESS = "localhost";
private static int PORT = 6300;
/** * Start the server as a standalone program. * * @param args * @throws IOException */ public static void main(final String[] args) throws IOException { final ExecutionDataWriter fileWriter = new ExecutionDataWriter(new FileOutputStream(DESTFILE)); final ServerSocket server = new ServerSocket(PORT, 0, InetAddress.getByName(ADDRESS)); while (true) { try { final Handler handler = new Handler(server.accept(), fileWriter); new Thread(handler).start(); } catch (Exception e) { e.printStackTrace(); System.out.println(e.getMessage()); } } }
private static class Handler implements Runnable, ISessionInfoVisitor, IExecutionDataVisitor {
private final Socket socket;
private final RemoteControlReader reader;
private final RemoteControlWriter writer;
private final ExecutionDataWriter fileWriter;
Handler(final Socket socket, final ExecutionDataWriter fileWriter) throws IOException { this.socket = socket; this.fileWriter = fileWriter;
// Just send a valid header: writer = new RemoteControlWriter(socket.getOutputStream());
reader = new RemoteControlReader(socket.getInputStream()); reader.setSessionInfoVisitor(this); reader.setExecutionDataVisitor(this); }
public void run() { try { writer.visitDumpCommand(true, false); while (reader.read()) { } socket.close(); synchronized (fileWriter) { fileWriter.flush(); } } catch (final IOException e) { e.printStackTrace(); } }
public void visitSessionInfo(final SessionInfo info) { System.out.printf("Retrieving execution Data for session: %s%n", info.getId()); synchronized (fileWriter) { fileWriter.visitSessionInfo(info); } }
public void visitClassExecution(final ExecutionData data) { synchronized (fileWriter) { fileWriter.visitClassExecution(data); } } }
private ExecutionDataServer() { }}--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/34854dc9-1a80-4019-bfd2-8b0571d9a993%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to jac...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/3b09bd80-951b-4d11-a3e6-8cdf9b171d35%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/ECA78200-CD4F-4C5F-AB10-A2EA9C7C6ED9%40mountainminds.com.
Yes, but I execute this in infinite loop which will continuously request to dump execution data.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/a69ec41f-4f54-4400-ad9d-0e585c134780%40googlegroups.com.