tag:blogger.com,1999:blog-5192882573953138361.post707018796819284166..comments2022-03-25T02:10:10.698-07:00Comments on Mike's Java blog: (Synchronized) Singleton design pattern in JavaMikehttp://www.blogger.com/profile/05448370454151696512noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-5192882573953138361.post-45999201501345654022009-05-22T01:22:09.318-07:002009-05-22T01:22:09.318-07:00Multiple Instances Resulting from Incorrect Synchr...Multiple Instances Resulting from Incorrect Synchronization<br /><br />// Also an error, synchronization does not prevent<br />// two calls of constructor.<br />public static MySingleton getInstance() {<br /> if (_instance==null) {<br /> synchronized (MySingleton.class) {<br /> _instance = new MySingleton();<br /> }<br /> }<br /> return _instance;<br />} <br /><br />see http://Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5192882573953138361.post-6890971465414321692009-01-29T05:22:00.000-08:002009-01-29T05:22:00.000-08:00Great!! i 'm implemented this code in webservicesp...Great!! i 'm implemented this code in webservicesproxy who depends of project fase. Works perfect.Linkamphttps://www.blogger.com/profile/04036502129813392419noreply@blogger.comtag:blogger.com,1999:blog-5192882573953138361.post-3097863288174539722008-11-11T07:48:00.000-08:002008-11-11T07:48:00.000-08:00Hi,nice blog. Found some interesting articles.Howe...Hi,<BR/><BR/>nice blog. Found some interesting articles.<BR/><BR/>However, your implementation of LazyInitializationMultiThreaded is unfortunately not correct regarding synchronization. This type of synchronization attempt is called "double-checked locking". An elaborate article on this topic can be found here: http://www.ibm.com/developerworks/java/library/j-dcl.html<BR/><BR/>And here on a (evenAnonymousnoreply@blogger.com