What is difference between singleton and connection pooling? or are they similar?
1 Answer
Singleton is a design pattern that restricts the instantiation of a class to one object.
Connection Pooling is an implementation of Object pool pattern that uses a set of initialized objects kept ready to use – a "pool" – rather than allocating and destroying them on demand. In this case Objects are Connections.
2 Comments
Hacker
In singleton same happens right? the object is not destroyed. Same copy is given to all
SkyDream
A Connection Pool of size 1 would be the same as a Singleton but a Connection Pool is also used to create abstraction in connections maintenance process and optimize memory use. Singleton is often used to be sure you wont get more than one instance of the Class, not always to reduce memory use. Not exactly the same intent.