In the batch processing service, it is necessary to accept a list of tasks, deduplicate them by businessId, run the status check asynchronously, and return the final result in the same order as the input list. Also, all temporary resources created during the request must be released after the operation completes, regardless of success or error. Java 21 and only the standard library are used; build and run happen without additional dependencies. You need to find and fix the problems in the proposed PR diff. The behavior that must be preserved: repeated elements with the same businessId are considered one task; errors from one asynchronous check must be visible in the result; execution must not leave open resources. Reproduction: 1) pass two objects with the same businessId and different fields; 2) call processing with one element that will fail in a CompletableFuture; 3) check that after the request completes the resource is closed. The expected fix should affect only the shown files and should not require an external environment.
Java 21, standard library only; execution mode: compile and run the changed sources with javac/java in a single JVM process; no additional libraries, no network, no database.
Use line comments to explain the problem, its impact, the fix and how to test it.