On Fri, 15 Aug 2025 20:06:21 GMT, Sergey Bylokhov <[email protected]> wrote:
>> I thought about that whilst making the change, but >> (1) The javax.imagio.ImageIO class has this code >> >> private static final IIORegistry theRegistry = >> IIORegistry.getDefaultInstance(); >> >> So it is going to get initialized really early on in virtually all uses of >> ImageIO, so doing as I did seems fine. >> >> (2) The code in getDefaultInstance() is now going to run 1,000 times faster >> than it did before so stable value to get it running 2,000 times faster >> probably is not necessary. And in any case, the version cached on ImageIO is >> what is going to be used. Hmm, it probably should not have been doing that >> as it defeated the AppContext, but it doesn't matter now. > > I am not worried much about performance, but I am concerned about the > possibility of a deadlock in static initializers, since the services loaded > by the IIORegistry can trigger any code. > > btw why not "private static final IIORegistry registry = new IIORegistry();"? Yes, I might as well now do that initialization. I don't see how there's any deadlock risk here, and certainly no more than before. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26752#discussion_r2289234426
