RFR: 8359266: Delete the usage of AppContext in the GraphicsDevice

Alexey Ivanov aivanov at openjdk.org
Fri Jun 20 18:58:28 UTC 2025


On Fri, 20 Jun 2025 01:23:23 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> src/java.desktop/share/classes/java/awt/GraphicsDevice.java line 306:
>> 
>>> 304:         }
>>> 305:         // Set the full screen window
>>> 306:         synchronized (fsAppContextLock) {
>> 
>> A `synchronized` block has stronger memory consistency guarantees than a `volatile` modifier.
>> 
>> Did you consider leaving the synchronized block but removing the usage of `AppContext`?
>
> What do you mean by stronger in this use case?

I mean that there's a _happens before_ relation each time the synchronized block is reach whereas with volatile, the _happens before_ relation is guaranteed only when the value of the variable changes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25818#discussion_r2159523719


More information about the client-libs-dev mailing list