RFR: 8284199: Implementation of Structured Concurrency (Incubator)

ExE Boss duke at openjdk.java.net
Mon May 23 11:13:32 UTC 2022


On Thu, 19 May 2022 13:05:54 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> This is the implementation of JEP 428: Structured Concurrency (Incubator).
> 
> This is a non-final API that provides a gentle on-ramp to structure a task as a family of concurrent subtasks, and to coordinate the subtasks as a unit.

src/jdk.incubator.concurrent/share/classes/jdk/incubator/concurrent/StructuredTaskScope.java line 1172:

> 1170:                 }
> 1171:             };
> 1172:             return AccessController.doPrivileged(pa);

It might be better to use `MethodHandle`s obtained using <code>[jdk.internal.access.SharedSecrets]&#x200B;.getJavaLangInvokeAccess()</code> and <code>[JavaLangInvokeAccess]&#x200B;.findStatic(…)</code> and <code>[JavaLangInvokeAccess]&#x200B;.findVirtual(…)</code> for this, which would avoid going through `AccessController.doPrivilaged(…)`.

[jdk.internal.access.SharedSecrets]: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/jdk/internal/access/SharedSecrets.java
[JavaLangInvokeAccess]: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/jdk/internal/access/JavaLangInvokeAccess.java

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

PR: https://git.openjdk.java.net/jdk/pull/8787


More information about the core-libs-dev mailing list