<div dir="ltr">Hello,<div><br></div><div>I've been playing around with the latest EA (<a href="https://openjdk.org/jeps/8340343">https://openjdk.org/jeps/8340343</a>) build with Joiners et al.</div><div>I'm building a small utility which reads a list of http requests from a file and runs them concurrently. These tasks have an associated test which is an assertion about the http response. </div><div>Tasks can either succeed or they can fail in two ways: </div><div><br></div><div>1) expected failure: test or its execution can fail </div><div>2) something unexpected outside of the test execution e.g NPE happens. </div><div><br></div><div>Task are self-contained and TaskResponse contains all the data needed for reporting the outcome to the user:</div><div><br></div><div>sealed interface TaskResult {</div><div>  record Success(....) ...</div><div>  record TestFailed(... ) .. // test failed</div><div>  record Failure(...) ... // something else failed e.g an exception during the http call</div><div>}</div><div><br></div><div>In case of successfull SubTask I need to check if the TaskResult is TestFailed or Failure, and shutdown the scope preventing processing of tasks, and report about the outcome.</div><div>In case of any SubTask if failing I need only the exception from the last SubTask::exception().</div><div><br></div><div>I started with a StructuredTaskScope.Joiner.allUntil(<a predicate which examines TaskResult>) but noticed that join() doesn't throw, and thus proceeded in implementing a custom Joiner which stores the last exception and overrides result and onComplete - methods.</div><div><br></div><div>Just wanted to verify: Is it the "idiomatic" way of using the new preview api, or is there some existing Joiner which would offer the functionality I'm after?</div><div><br></div><div><br></div><div><br></div></div>