On Mon, 28 Sep 2026 12:01:15 GMT, Alan Bateman <[email protected]> wrote:

>> This is the update to make STS a permanent API. `@PreviewFeatures` is 
>> dropped the `@since` tags bumped to 28. Tests are updated to drop 
>> `@enablePreview`. 
>> 
>> There are several updates to the API docs, mostly improvements to wording 
>> and specifying some corner cases. All are local, there no significant 
>> refactoring of the API docs. The first example is moved closer to the top 
>> and several areas of the docs are changed to improve readability.
>> 
>> Testing: Tier1-3
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Alan Bateman has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 11 additional 
> commits since the last revision:
> 
>  - Specify fork to invoke onComplete if unable to create Thread
>  - Merge branch 'master' into JDK-8391460
>  - Merge branch 'master' into JDK-8391460
>  - More API docs improvements
>  - Merge branch 'master' into JDK-8391460
>  - Merge branch 'master' into JDK-8391460
>  - Improve wording
>  - Merge branch 'master' into JDK-8391460
>  - Improve API docs
>  - Merge branch 'master' into JDK-8391460
>  - ... and 1 more: https://git.openjdk.org/jdk/compare/663a5ad8...86aeb2ca

test/jdk/java/util/concurrent/StructuredTaskScope/StructuredTaskScopeTest.java 
line 514:

> 512:         try (var scope = StructuredTaskScope.open(cf -> 
> cf.withThreadFactory(factory))) {
> 513:             // subtask1 completes
> 514:             var ref = new AtomicReference<Thread>();

Another option to using an AtomicReference here would be to use a 
SynchronousQueue<Thread> and have subtask1 put(Thread.currentThread()) and then 
having the test runner thread take()

Then we don't need the sleep-loop

test/jdk/java/util/concurrent/StructuredTaskScope/StructuredTaskScopeTest.java 
line 805:

> 803:             assertEquals(Subtask.State.UNAVAILABLE, subtask.state());
> 804:             assertThrows(IllegalStateException.class, subtask::get);
> 805:             assertThrows(IllegalStateException.class, 
> subtask::exception);

Might make sense to move these asserts into the close()-loop (to ensure that 
the transition occurs after the first invocation of close() (and doesn't change 
after any subsequent invocation).

test/jdk/java/util/concurrent/StructuredTaskScope/StructuredTaskScopeTest.java 
line 816:

> 814:     void testCloseWithoutJoin3(ThreadFactory factory) throws Exception {
> 815:         try (var scope = StructuredTaskScope.open(cf -> 
> cf.withThreadFactory(factory))) {
> 816:             var ref = new AtomicReference<Thread>();

SynchronousQueue<Thread>-approach should work here as well.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/32602#discussion_r4295071682
PR Review Comment: https://git.openjdk.org/jdk/pull/32602#discussion_r4295086529
PR Review Comment: https://git.openjdk.org/jdk/pull/32602#discussion_r4295090508

Reply via email to