On Tue, 24 Jan 2023 20:12:44 GMT, Andrey Turbanov <aturba...@openjdk.org> wrote:

> Oof... Approach for synchronization in `BeanContextServicesSupport` is 
> confusing for me and inconsistent. Do you know why read access to `children` 
> is not syncrhonized in `java.beans.beancontext.BeanContextSupport#add` ?
> 
> https://github.com/openjdk/jdk/blob/3be5758bb413fb6b4dc6191d78ca38332d5153f1/src/java.desktop/share/classes/java/beans/beancontext/BeanContextSupport.java#L394

Because synchronization in that class is mostly broken.

> // test before locking

I think it is an attempt to make a performance optimization even if it has a 
race, not sure that it works as expected.

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

PR: https://git.openjdk.org/jdk/pull/12158

Reply via email to