vlsi commented on code in PR #717:
URL: https://github.com/apache/jmeter/pull/717#discussion_r913832043


##########
src/core/src/main/java/org/apache/jmeter/engine/StandardJMeterEngine.java:
##########
@@ -84,6 +91,14 @@ public class StandardJMeterEngine implements JMeterEngine, 
Runnable {
     /** Whether to call System.exit(0) unconditionally at end of non-GUI test 
*/
     private static final boolean SYSTEM_EXIT_FORCED = 
JMeterUtils.getPropDefault("jmeterengine.force.system.exit", false);
 
+    /**
+     * Executor service to execute management tasks like "start test", "stop 
test".
+     * The use of {@link ExecutorService} allows propagating the exception 
from the threads.
+     */
+    private static final ExecutorService EXECUTOR_SERVICE = 
Executors.newCachedThreadPool();

Review Comment:
   I do not think UncaughtExceptionHandler makes things any easier/better. I 
think `EXECUTOR_SERVICE.submit(...)` gives exception tracking for free, and we 
should move away from `new Thread` anyway.
   
   ---
   
   The main problem here is that `StandardJMeterEngine.runTest` returns `void`, 
and there's no way for the client to detect if the test failed or not.
   
   In the ideal case, `StandardJMeterEngine.runTest` should return something 
like `Future<...>`, so the client could await termination or cancel it, or get 
the results.
   
   However, the change of `runTest` to return `Future` is out of the scope of 
this PR. In this PR, I added the ability to execute and wait for results from 
`StandardJMeterEngine` from unit-test code. So I did the minimal set of changes 
only.
   
   
    



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to