If I'm understanding your problem correctly, then you can just use semaphores to limit the number of concurrent actions.
Benoit LEFEVRE -CAMPUS- <[email protected]> ezt írta (időpont: 2025. dec. 15., H, 18:47): > Hello > > I recently wondered if there was any room left to implement some kind of > poor man's "back pressure" system thanks to the latest version of > StructuredTaskScope ? > > Behind this "poor man's back pressure" term, I have in mind something like > : > > > - an endpoint to be called for X distinct IDs > - a loop that "*.fork"* the M first calls, then wait until one > complete before forking the M+1 call ... > - ... and so on until all calls got forked > - then wait for the remaining calls completions by calling the join > method > > The point being of course to have at most M calls in flight at a time > > I doubt it's still possible to do it seeing the latest evolution of the > API in Java 25, especially since the "event callbacks" from the Java 21 > implementation don't seem to be available anymore, but maybe I'm wrong ? > > Looking forward to your advice about it ! > > Best regards. > > > -- > Benoit Lefèvre >
