@TimeStep public void timeStep(ThreadState state) throws Exception { if (state.responseFuture.thread == null) { state.responseFuture.thread = Thread.currentThread(); } Connection connection = state.nextConnection(); byte[] payload = makePayload(payloadSize); Packet requestPacket = new Packet(payload, state.workerId); if (!connection.write(requestPacket)) { throw new TestException("Failed to write packet to connection %s", connection); } try { state.responseFuture.get(requestTimeout, requestTimeUnit); } catch (Exception e) { throw new TestException("Failed to receive request from connection %s within timeout %d %s", connection, requestTimeout, requestTimeUnit, e); } state.responseFuture.reset(); }
@TimeStep public void timeStep(ThreadState state) throws Exception { if (state.responseFuture.thread == null) { state.responseFuture.thread = Thread.currentThread(); } Connection connection = state.nextConnection(); byte[] payload = makePayload(payloadSize); Packet requestPacket = new Packet(payload, state.workerId); if (!connection.write(requestPacket)) { throw new TestException("Failed to write packet to connection %s", connection); } try { state.responseFuture.get(requestTimeout, requestTimeUnit); } catch (Exception e) { throw new TestException("Failed to receive request from connection %s within timeout %d %s", connection, requestTimeout, requestTimeUnit, e); } state.responseFuture.reset(); }
@TimeStep public void timeStep(ThreadState state) throws Exception { if (state.responseFuture.thread == null) { state.responseFuture.thread = Thread.currentThread(); } Connection connection = state.nextConnection(); byte[] payload = makePayload(payloadSize); Packet requestPacket = new Packet(payload, state.workerId); if (!connection.write(requestPacket)) { throw new TestException("Failed to write packet to connection %s", connection); } try { state.responseFuture.get(requestTimeout, requestTimeUnit); } catch (Exception e) { throw new TestException("Failed to receive request from connection %s within timeout %d %s", connection, requestTimeout, requestTimeUnit, e); } state.responseFuture.reset(); }