arturobernalg opened a new pull request, #180:
URL: https://github.com/apache/maven-jarsigner-plugin/pull/180

   Fixes #148.
   
   `processArchives()` created the `ExecutorService` and built the list of 
submitted `Future`s (`archives.stream().map(executor::submit).collect(...)`) 
*before* the `try` block whose `finally` clause shuts it down. Any exception 
raised while building that list -- for example if `submit()` itself throws -- 
skips the `try` entirely, so `executor.shutdownNow()` is never called and any 
worker thread already spawned for an earlier archive keeps running.
   
   Moved the stream pipeline that submits the work inside the existing `try` 
block, so `executor.shutdownNow()` in the `finally` clause now covers every way 
archive processing can fail, not just failures raised while waiting on the 
futures (`future.get()`).
   
   I didn't add a dedicated leak-detection test: reliably forcing 
`executor.submit()` itself to throw synchronously (as opposed to the submitted 
task failing, which was already covered by the pre-existing `try`) isn't 
practical without making the `ExecutorService` injectable, which felt like more 
change than this fix warrants. Verified instead by full module test suite, 
including the existing parallel-execution tests in 
`JarsignerSignMojoParallelTest` (unchanged, still green), checkstyle and 
spotless.
   
   - [x] I hereby declare this contribution to be licensed under the Apache 
License Version 2.0, January 2004
   - [x] I hereby declare that I have filed an Apache Individual Contributor 
License Agreement.


-- 
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