|
Sponsored Links
Resources
Enterprise Java Research Library
Get Java white papers, product information, case studies and webcasts
|
Blogs
Blogs
Blogs
|
Messages: 2
Messages: 2
Messages: 2
Printer friendly
Printer friendly
Printer friendly
Post reply
Post reply
Post reply
XML
XML
XML
|
 |
Problems with design pattern "Singleton"
The use of the design pattern "Singleton" is very common and the common implementation is using a static reference. However, according to Guy Korland, the problem with this implementation is that many times it leaves "floating garbage that is not in use."
As a better solution, Joshua ben Jore has introduced WeakSingleton. This extention cleans the instance when all other references to the original instance have expired.
|
|
Message #215240
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Singleton Pattern's possible pitfalls
Singleton is a commonly (mis) used design pattern. Users of this pattern should be aware of the scope & lifecycle control of the singleton object.
Singleton could be at various scope levels. 1. Singleton object within a operating system environment or JVM.
2. Singleton object across clustered environments. It may not be considered singleton from application's perspective.
3. Singleton in a multi-threaded application. It should be thread safe for which programming Idioms are available.
|
|
Message #217641
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Warning: Not threadsafe
The code given is not threadsafe and using volatile with 1.5 may not solve the problem.
|
|
 |
Featured SectionFeatured SectionFeatured Section |
 |
 |
|
|
Weekly Blogs UpdateWeekly Blogs UpdateWeekly Blogs Update |
 |
 |
|
|
Featured BlogsFeatured BlogsFeatured Blogs |
 |
 |
Dmitri Maximovich has written a blog on optimizing CMP EJB performance in WebLogic, by addressing optimistic concurrency, along with some of the implications of doing so.
|
Brian McCallister looks at the Lucene search engine and shows us how to index and retrieve objects from a sample Student application.
|
Cedric Beust has been in a position to actually code with JDK 5 for over six months. He has written up his thoughts on the new features, and how he has found them to be in practice.
|
Mike Clark has started a series of entries of letters that you wish you could write to your boss. It consists of concepts which seem so obvious to us, but which the bosses don't get.
|
Brian McCallister has been playing with JDO 2 fetch groups, ZODB, thinking about TranQL, playing with Prevayler, and looking at TORPEDO.
|
Frank talks about fear and how it can derail efforts to find and solve scalability and performance problems. He has seen a lot of fear on his various engagements, and here he talks about why, and how.
|
Brian McCallister has kindly rambled on about IoC, and design in web applications. He discusses what has worked well for him (and others) in the last year.
|
Matt Raible went to the Denver JUG meeting with Neal Gafter, and Joshua Bloch. They discussed the new features of Java 5, and Matt details the features, and when to use them.
|
|
Featured Blogs Archive
|
|
|