Commit db99fce8 authored by Carlos Galindo's avatar Carlos Galindo
Browse files

Auto-start Erlang server connection.

If you are performing benchmarks, you should revert this commit and manually start the server, because it affects the speed of the slicer (the parser step).
parent 878d4fad
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -63,9 +63,9 @@ public class ErlConnection
			try
			{
				this.clientNodeName = this.defaultClientNodeName + id;
				this.serverNodeName = this.defaultServerNodeName;
				this.cookie = this.defaultCookie;
//				this.openServer();
				this.serverNodeName = this.defaultServerNodeName + id;
				this.cookie = this.defaultCookie + id;
				this.openServer();
				this.clientNode = new OtpSelf(this.clientNodeName + "@localhost", this.cookie);
				this.serverNode = new OtpPeer(this.serverNodeName + "@localhost");
				this.serverNode.setCookie(this.cookie);
@@ -97,13 +97,14 @@ public class ErlConnection
		}
	}
	private void openServer() throws Exception {
		// Start an `erl` process with a shell, so that it has some output, and we can
		// measure using Flusher that it has started.
		final File scriptsFile = this.config.getScriptsFile();
		serverProcess = new ProcessBuilder()
				.command("erl", "-noshell", "-pa", scriptsFile.getAbsolutePath(),
						"-name", this.serverNodeName + "@localhost", "-setcookie", this.cookie)
				.inheritIO()
				.start();
		Thread.sleep(3000);
		serverProcess = new ProcessBuilder("erl", "-pa", scriptsFile.getAbsolutePath(),
				"-name", this.serverNodeName + "@localhost", "-setcookie", this.cookie).start();
		final Flusher flusher = new Flusher(this.serverProcess, true, true);
		flusher.start();
		while (flusher.getOutput(Output.Standard).isEmpty() && flusher.getOutput(Output.Error).isEmpty());
	}
	private void closeServer()
	{