original-brownbear commented on code in PR #13472: URL: https://github.com/apache/lucene/pull/13472#discussion_r1664758046
########## lucene/core/src/test/org/apache/lucene/search/TestTaskExecutor.java: ########## @@ -251,14 +271,15 @@ public void testInvokeAllDoesNotLeaveTasksBehind() { for (int i = 0; i < tasksWithNormalExit; i++) { callables.add( () -> { - tasksExecuted.incrementAndGet(); - return null; + throw new AssertionError( + "must not be called since the first task failing cancels all subsequent tasks"); }); } expectThrows(RuntimeException.class, () -> taskExecutor.invokeAll(callables)); assertEquals(1, tasksExecuted.get()); // the callables are technically all run, but the cancelled ones will be no-op - assertEquals(100, tasksStarted.get()); + // add one for the task the gets executed on the current thread Review Comment: > My concern was that the last task does not go through the executor and we don't really know if it was executed nor started? We do, because we would throw an `AssertionError` if it was started with my changes :) Other than that, note that we still wrap tasks the same way so the cancelled flag is seen the exact same way by tasks running on caller thread or in the executor, I did not change anything about that (yet :)). We could clean that up but for now from the cancellation perspective this is fully symmetrical. -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org