changeset 1004:7ace98380747

FlowExecutor.join(long timeout)
author Devel 2
date Wed, 18 Mar 2020 12:27:23 +0100
parents a7c986455443
children c91b2c0ca234
files stress-tester/src/main/java/com/passus/st/client/FlowExecutor.java stress-tester/src/test/java/com/passus/st/client/netflow/FlowExecutorNetflowTest.java
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/FlowExecutor.java	Fri Oct 04 14:56:43 2019 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/FlowExecutor.java	Wed Mar 18 12:27:23 2020 +0100
@@ -208,6 +208,16 @@
         return false;
     }
 
+    public void join(long timeout) throws InterruptedException {
+        for (FlowWorker worker : workers) {
+            try {
+                worker.join(timeout);
+            } catch (InterruptedException ignore) {
+
+            }
+        }
+    }
+
     public void join() throws InterruptedException {
         for (FlowWorker worker : workers) {
             worker.join();
--- a/stress-tester/src/test/java/com/passus/st/client/netflow/FlowExecutorNetflowTest.java	Fri Oct 04 14:56:43 2019 +0200
+++ b/stress-tester/src/test/java/com/passus/st/client/netflow/FlowExecutorNetflowTest.java	Wed Mar 18 12:27:23 2020 +0100
@@ -53,7 +53,7 @@
         try {
             flowExecutor.start();
             events.forEach(flowExecutor::handle);
-            flowExecutor.join();
+            flowExecutor.join(5_000);
 
             assertEquals(0, listener.getErrors());
             assertEquals(2, listener.getReceived().size());