Monday, June 9, 2014

Object Pool Pattern in Java

Simple Note

From reference:
The object pool pattern is a software creational design pattern that uses a set of initialized objects kept ready to use – a "pool" – rather than allocating and destroying them on demand. A client of the pool will request an object from the pool and perform operations on the returned object. When the client has finished, it returns the object to the pool rather than destroying it; this can be done manually or automatically.


Run to test.

The ThreadPool create and handle WorkingThread to execute Runnable task,
and use Decorator Pattern to wrap Runnable task to restore WorkingThread automatically for reuse.


Object pool pattern

No comments:

Post a Comment