RFR: 8323670: A few client tests intermittently throw ConcurrentModificationException

Andrey Turbanov aturbanov at openjdk.org
Mon Jan 22 08:36:27 UTC 2024


On Mon, 22 Jan 2024 08:30:05 GMT, Tejesh R <tr at openjdk.org> wrote:

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

_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.

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

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


More information about the client-libs-dev mailing list