<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<br>
<br>
<div class="moz-cite-prefix">On 05/04/2025 01:18, Sergii Chekotylo
wrote:<br>
</div>
<blockquote type="cite" cite="mid:83D8AC8D-540D-4AD0-B7E3-DCB498877DF6@gmail.com">
<pre class="moz-quote-pre" wrap="">The idea is to have a limited time for multiple tasks to finish.
But if any of them didn’t finish - how to make sure that all of not-finished are interrupted and not using resources.
Example:
For one incoming http request I need to make 100 external calls to other systems to prepare data.
And I need to have my own SLA no matter what is happening with other endpoints.
If I’ll put joinUntill(“3s”) and my external calls are longer than that I should get TimeOutException.
Which I can process in some way and give a result back.
But what will happen to all unfinished tasks? Are they going to be interrupted or they will run till something else happened in each of them?
</pre>
</blockquote>
joinUntil will throw TimeoutException, and assuming you are using
the try-with-resources construct, then close will interrupt the
threads executing the unfinished subtasks and wait until they
complete. <br>
<br>
For your use-case then I assume you have extended STS and overridden
handleComplete to collect the subtasks that completed successfully.
The subtask will expose a method to get the completed subtasks.<br>
<br>
-Alan<br>
<br>
<br>
</body>
</html>