RFR: 8297276: Remove thread text from Subject.current

Weijun Wang weijun at openjdk.org
Tue Nov 22 17:15:18 UTC 2022


On Tue, 22 Nov 2022 17:05:52 GMT, Xue-Lei Andrew Fan <xuelei at 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`.
>
> src/java.base/share/classes/javax/security/auth/Subject.java line 329:
> 
>> 327:      * subject is {@code null} before the first call of {@code callAs()}.
>> 328:      * <p>
>> 329:      * When a new thread is created, its current subject is the same as
> 
> what about change from"when" to "if", in case some implementation still create a new thread?

This is not about the implementation of this method, which might or might not allow the current subject to be inherited in a new thread. The spec change is telling the users of this method that such inheritance is no longer guaranteed. We are still not sure if the future implementation of this method can guarantee that, but given it's already broken now, we'd better remove this requirement. We can add if later if we can do that.

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

PR: https://git.openjdk.org/jdk/pull/11292


More information about the security-dev mailing list