On Mon, 20 Sep 2021 16:58:49 GMT, Sergey Bylokhov <[email protected]> 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