• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

any singleton pattern early instantiated issues

 
Krishnaa Kumar
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I came across some issues using lazy instantiated singleton pattern

Reference: http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html.

Similarly is there any issues in using early instantiated singleton pattern?
 
Nomaan Butt
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Krishnna,
Below text from the link mentioned by you above specifies that issues with lazy initialization of singletion have been taken care off.
JDK5 and later extends the semantics for volatile so that the system will not allow a write of a volatile to be reordered with respect to any previous read or write, and a read of a volatile cannot be reordered with respect to any following read or write




 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic