gnodet opened a new pull request, #24450:
URL: https://github.com/apache/camel/pull/24450

   ## Summary
   
   _Claude Code on behalf of Guillaume Nodet_
   
   Fix flaky `ServletStreamingChunkedTest` by replacing `Thread.sleep(500)` 
calls with proper `CountDownLatch`-based synchronization:
   
   - **First sleep**: replaced with a `requestStarted` CountDownLatch that the 
main thread counts down after the HTTP request has been processed and response 
headers confirmed (200, chunked). This ensures the writer only starts producing 
data once the servlet is actively streaming the response.
   - **Second and third sleeps** (after `latch1.await`/`latch2.await`): removed 
entirely as the existing latches already provide the necessary synchronization 
between reader and writer for subsequent chunks.
   
   The fixed-delay `Thread.sleep(500)` was unreliable on slow CI environments 
(not enough time) and wasteful on fast machines (unnecessary waiting).
   
   ## Test plan
   
   - [x] `mvn test -pl components/camel-servlet 
-Dtest=ServletStreamingChunkedTest` — passes
   - [x] Ran test 3 additional times in a loop to verify stability — all green
   - [x] `mvn formatter:format impsort:sort` — no formatting issues
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to