I have implemented this object pool (using org.apache.commons.pool2) to manage a pool of objects, which is defined in the parent class, say A
There are a few child classes, for eg: B and C which extend A - and makes use of this object pool. The issue I see is that, there are lots of object pools being created (and hence objects) - overloading the server. What I would like to achieve is that, each child class should have its own object pool, and only one.
Defining the object pool as static in A would mean that there's just 1 object pool created both for the parent as well as the child together. This, I do no want.
I also read that we should make the Object pool a Singleton. Would that be one way to achieve? I am not able to get my head around it, so any help in this regard would be very much appreciated!
Note: I have kept the details very abstract, hope it is clear. I can explain more if required.