On 21/08/2025 12:07, Subrahmanyam V wrote:
:
But, on reflection, an application can get all of the above benefits
if it sticks exclusively to the _race()_ or _runConcurrently()_
constructs from the JEP. That is, instead of _Policy Classes_, it uses
_Policy Methods_ like race(). Which begs the question - should the
structured concurrency API also expose Policy Methods as a first class
API, one Policy Method per Joiner?
It would be possible to provide a set of combinators along the lines of
the examples presented in the JEP. It turns the feature into a set of
"utility methods" and doesn't help with the main goal of promoting
usages that address issues around cancellation and shutdown. It's also
somewhat unsatisfactory when trying to do something that is a bit
different to one of the canned policies. So yes, we've been there but
decided against that direction.
-Alan