hi!

double checked locking will only work, if associationCache is declared as
VOLATILE.

see  following page for background information on double checked locking:
http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

you should check your whole codebase for that pattern. i have already filed
a bug for EventPublusher in bamdataagents.

https://wso2.org/jira/plugins/servlet/mobile#issue/BAMDATAAGENTS-10


regards,

thomas

Am Dienstag, 2. September 2014 schrieb Tharindu Edirisinghe :

> In OpenIDAssociationCache, the method to get the singleton instance is
> synchronized. Isn't it better to improve this with applying double checked
> locking ??
>
>
> turing/components/identity/org.wso2.carbon.identity.provider/4.2.2/src/main/java/org/wso2/carbon/identity/provider/openid/cache/OpenIDAssociationCache.java
>
> Following is the code segment currently it is having.
>
>     /**
>      * Returns the singleton of the <code>AssociationCache</code>
>      *
>      * @return
>      */
>     public synchronized static OpenIDAssociationCache getCacheInstance() {
>         if (associationCache == null) {
>             associationCache = new OpenIDAssociationCache();
>         }
>         return associationCache;
>     }
>
> --
>
> Thanks & Best Regards,
>
> Tharindu Edirisinghe
> Software Engineer
>
> *WSO2 Inc*
> *email   : [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');> *
> *mobile : +94 775 181586*
> *www: :http://wso2.com <http://wso2.com/> *lean . enterprise . middleware
>
>
>
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to