RFR: 8325179: Race in BasicDirectoryModel.validateFileCache [v2]

Alexey Ivanov aivanov at openjdk.org
Tue Mar 5 11:07:14 UTC 2024


On Tue, 5 Mar 2024 00:48:13 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Alexey Ivanov has updated the pull request incrementally with four additional commits since the last revision:
>> 
>>  - Replace synchronized invalidateFileCache with synchronized block inside
>>  - Declare DoChangeContents constructor private, wrap its parameters
>>  - Space after synchronized in DoChangeContents.run
>>  - Convert runnable to local variable
>
> src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java line 101:
> 
>> 99:      */
>> 100:     public synchronized void invalidateFileCache() {
>> 101:         if (filesLoader != null) {
> 
> This is a public API method, can we minimize the change and use "synchronized (this)" instead?

The `synchronized` modifier is not part of public API specification, it's not shown in the generated Javadoc. Anyway, I updated the code to use `synchronized (this)` block inside the method.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18111#discussion_r1512638838


More information about the client-libs-dev mailing list