Mercurial > stress-tester
changeset 1107:b626a5120c4f
FlowWorker.TIMEOUT_FACTOR
author | Devel 2 |
---|---|
date | Tue, 19 May 2020 13:46:36 +0200 |
parents | 057627ea54d5 |
children | 27b0c92658b0 |
files | stress-tester/src/main/java/com/passus/st/client/FlowProcessor.java stress-tester/src/main/java/com/passus/st/client/FlowWorker.java |
diffstat | 2 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/FlowProcessor.java Tue May 19 13:25:11 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/FlowProcessor.java Tue May 19 13:46:36 2020 +0200 @@ -81,7 +81,7 @@ flowContext.state = STATE_CONNECTING; emitter.connect(flowContext.session, this, workerIndex); if (wait) { - waitOpFinished(flowContext, STATE_CONNECTED, Long.MAX_VALUE); + waitOpFinished(flowContext, STATE_CONNECTED, timeouts.getConnectionTimeout()); } } catch (Exception ex) { error(flowContext, ex);
--- a/stress-tester/src/main/java/com/passus/st/client/FlowWorker.java Tue May 19 13:25:11 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/FlowWorker.java Tue May 19 13:46:36 2020 +0200 @@ -21,6 +21,8 @@ public static final int DEFAULT_MAX_SEND_ERRORS = 3; public static final int DEFAULT_RECONNECT_DELAY = 1000; + public static final float TIMEOUT_FACTOR = 1.75f; + protected final int index; private ClientListener listener; @@ -29,6 +31,8 @@ protected final Emitter emitter; + protected final Timeouts timeouts; + protected FlowHandlerFactory clientFactory = new FlowHandlerFactoryImpl(); protected boolean collectMetrics; @@ -47,8 +51,6 @@ protected long reconnectDelay = DEFAULT_RECONNECT_DELAY; - protected Timeouts timeouts = new Timeouts(); - protected final boolean trace; public FlowWorker(Emitter emitter, String name, int index) { @@ -57,6 +59,12 @@ this.emitter = emitter; this.index = index; this.trace = logger.isTraceEnabled(); + + Timeouts emitterTimeouts = emitter.getTimeouts(); + this.timeouts = new Timeouts(); + this.timeouts.setConnectionTimeout((long) (emitterTimeouts.getConnectionTimeout() * TIMEOUT_FACTOR)); + this.timeouts.setReadTimeout((long) (emitterTimeouts.getReadTimeout() * TIMEOUT_FACTOR)); + this.timeouts.setDisconnectTimeout((long) (emitterTimeouts.getDisconnectTimeout() * TIMEOUT_FACTOR)); } public Emitter getEmitter() {