On Wed, 28 Jan 2026 06:56:15 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

>> Remove AppContext from ImageFetcher
>
> src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java line 330:
> 
>> 328: 
>> 329:     static FetcherInfo getFetcherInfo() {
>> 330:         return FETCHER_INFO;
> 
> Can you please refresh my memory as to why synchronization will not be 
> required for this?
> I understand Swing is not thread-safe but there can be multiple images and 
> this is called from `ImageFetcher.add`, `ImageFetcher.remove` etc and it can 
> create "new FetcherInfo" instances, which is not desired, if access is not 
> synchronized, or so I think..

An interesting question… I think synchronisation is not required here because 
the method returns a static final field.

Access to the fields needs synchronisation, though; and the synchronisation is 
present as far as I can see, the methods of the class use 
`synchronized(info.waitList)`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29441#discussion_r2737520438

Reply via email to