thank you, carlo for response.
of course you are right, one could extend StrictMaxPool and enlarge strictMaxSize semaphore. but what is the benefit of using the semaphore at all? isnt it an unnecessary overhead? we believe we do not need a maximum to limit creation of instances, but we need a maximum of pooled instances!
so i thought about a pool implementation backed by a simple array with length maxSize:
- get() looks into the array and returns and removes the last element -if available;
- otherwise create a new one, no maximum for creating instances (aka tolerant)!
- instances that are released go back into the array -if they fit into it (maxSize = array length);
- otherwise they are removed immediately.
this seems to be quite simple to implement...?
would you expect any issues with such an implementation?