Mercurial > stress-tester
changeset 537:a3cf7c67258e
HttpAsynchClientWorker - performance improvements
author | Devel 2 |
---|---|
date | Mon, 11 Sep 2017 11:57:05 +0200 |
parents | 2d655c494e41 |
children | 83edfa7af445 |
files | stress-tester/src/main/java/com/passus/st/client/http/HttpAsynchClientWorker.java |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpAsynchClientWorker.java Mon Sep 11 11:13:10 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/HttpAsynchClientWorker.java Mon Sep 11 11:57:05 2017 +0200 @@ -38,6 +38,8 @@ private volatile boolean processWindow = false; + private volatile boolean flowStateChanged = false; + private final Object readerLock = new Object(); public HttpAsynchClientWorker(Emitter emitter, String name, int index) { @@ -147,6 +149,7 @@ @Override protected void flowStateChanged(HttpFlowContext context, int oldState) { synchronized (lock) { + flowStateChanged = true; lock.notifyAll(); } } @@ -162,12 +165,12 @@ SessionEventsTask task = window.getSessionEventsTask(session, true); task.events.add(payloadEvent); - HttpResponse resp = payloadEvent.getResponse(); + /*HttpResponse resp = payloadEvent.getResponse(); HttpRequest req = payloadEvent.getRequest(); long respTime = time + (resp.getTimestamp() - req.getTimestamp()); HttpResponseEvent respEvent = new HttpResponseEvent(session, resp, respTime); - task.events.add(respEvent); + task.events.add(respEvent);*/ break; } @@ -241,6 +244,7 @@ if (flowContext != null) { switch (flowContext.state) { case HttpFlowContext.STATE_CONNECTING: + case HttpFlowContext.STATE_REQ_SENT: return false; case HttpFlowContext.STATE_CONNECTED: case HttpFlowContext.STATE_RESP_RECEIVED: @@ -321,8 +325,10 @@ if (currentWindow.tasks.isEmpty()) { break; + } else if (!flowStateChanged) { + waitQuietly(); } else { - waitQuietly(); + flowStateChanged = false; } }