RFR: 8273581: Change the mechanism by which JDK loads the platform-specific FontManager class [v3]

Brett Okken github.com+2996845+bokken at openjdk.java.net
Mon Sep 20 17:18:55 UTC 2021


On Mon, 20 Sep 2021 16:58:49 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Does that stack trace difference really matter?
>> if so, you could wrap the `return FontManagerHolder.instance;` in a try/catch that throws that caused by:
>> 
>> 
>> try {
>>   return FontManagerHolder.instance;
>> } catch (java.lang.ExceptionInInitializerError e) {
>>   final Throwable cause = e.getCause();
>>   if (cause instanceof RuntimeException re) {
>>     throw re;
>>   }
>>   //could wrap in IllegalStateException or just throw the error
>> }
>> 
>> 
>> If this getInstance method is called with any frequency, getting rid of the volatile access each time is a nice bonus.
>
> The difference is that Holder will fail that way forever, while the DLC have a chance to resurrect on next call.

So I guess the question is whether there is a valid transitory failure use case?

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

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



More information about the client-libs-dev mailing list