jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Taylor <ja...@jamestaylor.org>
Subject Re: The Double-Checked Locking is Broken Declaration
Date Wed, 18 Dec 2002 12:32:30 GMT
You might search the archives for discussion regarding this (maybe in
the turbine or stratum archives)

Yes, DCL is broken. Yes it is probably still used in some places in JCS
(everywhere I have seen it I have removed it, but patches and such would
certainly be accepted).

On Wed, 2002-12-18 at 06:59, Georg Jüttner/inasys GmbH wrote:
> Hello,
> 
> can I use JCS in case of either optimizing compilers or shared memory multiprocessors?
> 
> In the JCS documentation "Using JCS: Some basics for the web" the example
> class BookVObjManager uses the Double-checked locking idiom.
> 
> This idiom is widely cited and used as an efficient method for implementing
> lazy initialization - but the references cited below show, that the
> Double-Checked Locking idiom does not work in case of either optimizing
> compilers or shared memory multiprocessors.
> 
> Is this idiom used in JCS internally, too?
> 
> Many thanks,
> Georg Juttner
> 
> 
> References:
> 
> http://developer.java.sun.com/developer/technicalArticles/Programming/singletons
> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
> 
> 
> Example for the Double-checked locking idiom:
> 
> // Double-checked locking -- don't use
> public static MySingleton getInstance() {
>  if (_instance==null) {
>    synchronized (MySingleton.class) {
>      if (_instance==null) {
>         _instance = new MySingleton();
>      }
>    }
>  }
>  return _instance;
> }
> 
> 
> |   inasys GmbH               |   +49-228-5205-0 (fon)
> |   Am Propsthof 76           |   +49-228-5205-100 (fax)
> |   D-53121 Bonn              |   http://www.inasys.de
> |
> |   Geschäftsführer: Ralf Schuster
> |   Handelsregister Bonn HRB 3994
> |   Ust-IDNr. DE 122 120 637
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:turbine-jcs-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:turbine-jcs-user-help@jakarta.apache.org>
> 


Mime
View raw message