Skip to content

Commit 09f0076

Browse files
author
Alan Bateman
committed
8373427: StructuredTaskScope::join not clear if called with interrupted status set
Reviewed-by: jpai Backport-of: 6af2742
1 parent d0a3ba9 commit 09f0076

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/java.base/share/classes/java/util/concurrent/StructuredTaskScope.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1081,10 +1081,9 @@ static <T> StructuredTaskScope<T, Void> open() {
10811081
* does not throw then the {@code Joiner}'s {@code result()} method is invoked to
10821082
* get the result or throw.
10831083
*
1084-
* <p> This method may only be invoked by the scope owner. Once the result or
1085-
* exception outcome is obtained, this method may not be invoked again. The only
1086-
* case where the method may be called again is where {@code InterruptedException}
1087-
* is thrown while waiting.
1084+
* <p> This method may only be invoked by the scope owner. It may only be invoked once
1085+
* to get the result, exception or timeout outcome, unless the previous invocation
1086+
* resulted in an {@code InterruptedException} being thrown.
10881087
*
10891088
* @return the result
10901089
* @throws WrongThreadException if the current thread is not the scope owner
@@ -1093,8 +1092,11 @@ static <T> StructuredTaskScope<T, Void> open() {
10931092
* exception from {@link Joiner#result() Joiner.result()} as the cause
10941093
* @throws TimeoutException if a timeout is set, the timeout expires before or while
10951094
* waiting, and {@link Joiner#onTimeout() Joiner.onTimeout()} throws this exception
1096-
* @throws InterruptedException if interrupted while waiting
1095+
* @throws InterruptedException if the current thread is interrupted before or
1096+
* while waiting. The current thread's interrupted status is cleared when this
1097+
* exception is thrown.
10971098
* @since 25
1099+
* @see Thread##thread-interruption Thread Interruption
10981100
*/
10991101
R join() throws InterruptedException;
11001102

0 commit comments

Comments
 (0)