On Mon, 22 Jan 2024 09:34:48 GMT, Tejesh R <t...@openjdk.org> wrote: >> `synchronized` _works_ only if synchronized object is the same in all >> places. In the new method "synchronized object" - is an instance of >> `FilesLoader`, while in other places `fileCache` is accessed under >> `synchronized(fileCache)`. > > Then adding `synchronized(fileCache)` in `FilesLoader` where list comparison > happens would be better idea?
Yes. If you go with `synchronized` then it should be `synchronized (fileCache)` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/17462#discussion_r1462913181