kri shan wrote:Hi David, Singleton is for creating single instance per JVM. If i use Singleton with Factories will support multi-threading.
Oh, I think I see what you mean. It's just that one thing has nothing to do with the other: one thing is multi-threaded programming (multiple Threads), and another one is a factory creating multiple objects. When you have multi-threaded programming, you have concurrency, and you should protect the integrity of the objects that suffer this concurrency (with synchronized methods, synchronized blocks, etc...). A Singleton is an object whose instance is unique, but it can be accessed by one or N Threads.
posted 10 years ago
A Singleton is an object whose instance is unique, but it can be accessed by one or N Threads using Factories.
Hi Robert, You are correct.
30 seconds to difuse a loaf of bread ... here, use this tiny ad: