On Mon, 22 Jan 2024 07:39:04 GMT, Andrey Turbanov <[email protected]> wrote:

>> Yes, which is why I am using Synchronized to handle 
>> `concurrentModificationException`.
>
> It doesn't work like this. Modification happen in another thread in another 
> method. This `synchronized` doesn't affect another method.

"_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?

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

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

Reply via email to