On Wed, 23 Nov 2022 12:35:17 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> With the introduction of Virtual Threads, the current subject is no longer >> guaranteed to be inherited in a new thread. Remove this requirement until we >> find another way to implement `Subject::current`. > > Just re-reading the javadoc for Subject.callAs. It doesn't say anything about > inheritance so there shouldn't be any expectation that Subject is inherited, > so I think the change proposed here is okay. For another PR but I think the > callAs javadoc could say a bit more about the Subject being set for the > bounded execution of the given task. When the task completes, the current > Subject is null or reverts to its previous value in the current thread. @AlanBateman You are right. The `callAs` method is very short and only mentions "the current subject". My original idea is to describe everything about what "the current subject" means inside the `current()` method, which now talks about how it's set and reset. Do you think it's clearer to duplicate some of these words in `callAs` as well? Both the two methods currently have a `@see` pointing to the other. ------------- PR: https://git.openjdk.org/jdk/pull/11292