changeset 1252:aa5ba90755dd

FlowExecutor - missed workerType configuration
author Devel 2
date Thu, 02 Jul 2020 08:37:25 +0200
parents 974d2217d08c
children 0a0631e1b289
files stress-tester/src/main/java/com/passus/st/client/FlowExecutor.java
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/FlowExecutor.java	Wed Jul 01 14:30:20 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/FlowExecutor.java	Thu Jul 02 08:37:25 2020 +0200
@@ -28,6 +28,8 @@
 
 public class FlowExecutor implements EventHandler, MetricSource, Service, Configurable {
 
+    private static final String DEFAULT_WORKER_TYPE = "synch";
+
     private static final int DEFAULT_WORKERS_NUM = 1;
 
     private static final boolean DEFAULT_CONNECT_PARTIAL_SESSION = false;
@@ -58,7 +60,7 @@
 
     private long maxSleepTime = DEFAULT_MAX_SLEEP_TIME;
 
-    private String workerType = "synch";
+    private String workerType = DEFAULT_WORKER_TYPE;
 
     private int workersNum = DEFAULT_WORKERS_NUM;
 
@@ -214,6 +216,7 @@
             setListener(new MultipleClientListener(cfgListeners));
         }
 
+        workerType = config.getString("workerType", DEFAULT_WORKER_TYPE);
         setWorkersNum(config.getInteger("workers", DEFAULT_WORKERS_NUM));
         connectPartialSession = config.getBoolean("connectPartialSession", DEFAULT_CONNECT_PARTIAL_SESSION);
         collectMetrics = config.getBoolean("collectMetrics", DEFAULT_COLLECT_METRICS);
@@ -391,12 +394,19 @@
                 "source", "parallel"
         ));
 
+        private static final Set<String> WORKER_TYPES = new HashSet<>(Arrays.asList(
+                "synch", "parallel"
+        ));
+
         @Override
         public NodeDefinition create() {
             return mapDef(
                     tupleDef("connectPartialSession", BOOLEAN_DEF).setRequired(false),
                     tupleDef("collectMetrics", BOOLEAN_DEF).setRequired(false),
                     tupleDef("disconnectAllOnDataLoop", BOOLEAN_DEF).setRequired(false),
+                    tupleDef("workerType", valueDef()
+                            .addValidator(new EnumValidator(WORKER_TYPES, false))
+                    ).setRequired(false),
                     tupleDef("workers", INT_GREATER_THAN_ZERO_DEF).setRequired(false),
                     tupleDef("sleepFactor", valueDefFloat()).setRequired(false),
                     tupleDef("maxSleepTime", LONG_DEF).setRequired(false),