RFR: 8359119: Change Charset to use StableValue [v2]

Alan Bateman alanb at openjdk.org
Tue Jun 10 15:25:29 UTC 2025


On Tue, 10 Jun 2025 15:16:42 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> src/java.base/share/classes/java/nio/charset/Charset.java line 384:
>> 
>>> 382: 
>>> 383:     private static final Supplier<ThreadTracker> TRACKER = StableValue.supplier(
>>> 384:             new Supplier<>() { public ThreadTracker get() { return new ThreadTracker(); }});
>> 
>> ThreadTracker pre-dates ScopedValue. We could potentially use a  ScopedValue<Boolean> IN_USE here, or StableValue<ScopedValue<Boolean>> if there are issues running the class initializer in early VM startup. Separate discussion but we don't need ThreadTracker now.
>
> So, revert the changes here?

I think it's okay, it's just that the change is a reminder that all ThreadTracker usages can be replaced with a ScopedValue<Boolean> but may require a bit of work to allow using during early VM startup.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25727#discussion_r2138196314


More information about the nio-dev mailing list