Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CODETOOLS-7902920: jcstress: Rework binary link client/server for lower latency #48

Merged
merged 11 commits into from
May 4, 2021
Original file line number Diff line number Diff line change
@@ -351,7 +351,7 @@ void start() {

public synchronized ForkedTestConfig jobRequest() {
if (processed) {
return new ForkedTestConfig(task);
return null;
}
processed = true;
return new ForkedTestConfig(task);
Original file line number Diff line number Diff line change
@@ -32,6 +32,8 @@

public final class BinaryLinkClient {

private static final int LINK_TIMEOUT_MS = Integer.getInteger("jcstress.link.timeoutMs", 30 * 1000);

private final String hostName;
private final int hostPort;

@@ -42,6 +44,7 @@ public BinaryLinkClient(String hostName, int hostPort) {

public ForkedTestConfig jobRequest(int token) throws IOException {
try (Socket socket = new Socket(hostName, hostPort)) {
socket.setSoTimeout(LINK_TIMEOUT_MS);
try (OutputStream os = socket.getOutputStream();
DataOutputStream dos = new DataOutputStream(os)) {
Protocol.writeTag(dos, Protocol.TAG_JOBREQUEST);
@@ -62,6 +65,7 @@ public ForkedTestConfig jobRequest(int token) throws IOException {

public void doneResult(int token, TestResult result) throws IOException {
try (Socket socket = new Socket(hostName, hostPort)) {
socket.setSoTimeout(LINK_TIMEOUT_MS);
try (OutputStream os = socket.getOutputStream();
DataOutputStream dos = new DataOutputStream(os)) {
Protocol.writeTag(dos, Protocol.TAG_RESULTS);