On Mon, 22 Jan 2024 08:31:57 GMT, Andrey Turbanov <aturba...@openjdk.org> wrote:

>> "_Synchronized methods enable a simple strategy for preventing thread 
>> interference and memory consistency errors: if an object is visible to more 
>> than one thread, all reads or writes to that object's variables are done 
>> through synchronized methods_" as per this statement from the doc 
>> ([Synchronized 
>> Methods](https://docs.oracle.com/javase/tutorial/essential/concurrency/syncmeth.html))
>>  it should be handled right?
>
> _all reads or writes to that object's variables are done through synchronized 
> methods_
> 
> This is a key requirement. In your case you have added `synchronized` only to 
> a method, which reads that object. But a writer is not `synchronized` in you 
> case.

As per my analysis `fileCache` is synchronized in other places also. Do you 
notice any places where it is not synchronized?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17462#discussion_r1461504502

Reply via email to