Skip to main content

Posts

Showing posts with the label object pool

Creational Patterns: Object Pool

Properties: -            When cost of creating an object from scratch is high it might be a good idea to reuse already created objects. -            Identified by a pool class that objects are retrieved from and then released back to. Implementation: -            Reused objects might be wrapped by another object. -            Pool class keeps created objects. -            Client requests a new object instance from pool when it needs a new object. After client is done with object instance it releases the object, so that the object can be reused again. Java Example Usage: -            com.mchange.v2.c3p0.ComboPooledDataSource Example Usage: // create connection ...