RequestPacketHandler(int threadCount) { futures = new RequestFuture[threadCount]; for (int i = 0; i < futures.length; i++) { futures[i] = new RequestFuture(); } }
@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(); }
private void handleResponse(Packet packet) { RequestFuture future = futures[packet.getPartitionId()]; future.set(); }
@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(); }
private void handleResponse(Packet packet) { RequestFuture future = futures[packet.getPartitionId()]; future.set(); }
@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(); }
RequestPacketHandler(int threadCount) { futures = new RequestFuture[threadCount]; for (int i = 0; i < futures.length; i++) { futures[i] = new RequestFuture(); } }
private void handleResponse(Packet packet) { RequestFuture future = futures[packet.getPartitionId()]; future.set(); }
public RequestPacketHandler(int threadCount) { futures = new RequestFuture[threadCount]; for (int i = 0; i < futures.length; i++) { futures[i] = new RequestFuture(); } }