RFR: 8308588: Unnecessary synchronized on GTKStyle#ICONS_MAP can be removed

Abhishek Kumar abhiscxk at openjdk.org
Thu Aug 29 04:12:18 UTC 2024


On Wed, 28 Aug 2024 21:37:39 GMT, Alisen Chung <achung at openjdk.org> wrote:

> What's the benefit of removing synchronized from the get call? 

As I mentioned earlier, `ICONS_MAP` are initialized only in **static block** and after that it is just referenced to access the value out of it. Even though `ICONS_MAP` are accessed simultaneously for read operation by multiple threads, it won't lead to any  inconsistent state. So, the use of Synchronized look unnecessary to me and the removal of Synchronized shouldn't affect the object state in multi threaded environment.

> Also were tests run on all platforms that use GTK? 

Basically I ran the regression tests for linux platform which is supposed to have GTK environment.

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

PR Comment: https://git.openjdk.org/jdk/pull/20741#issuecomment-2316675427


More information about the client-libs-dev mailing list