This pools internal guarantees are that the max number of values are in the pool at any time, not maximum number of operations.
A managed Resource.
A managed Resource.
This knows whether it was reused or not, and has a reference that when it leaves the controlling scope will dictate whether it is shutdown or returned to the pool.
Reusable is a Coproduct of the two states a Resource can be in at the end of its lifetime.
Reusable is a Coproduct of the two states a Resource can be in at the end of its lifetime.
If it is Reuse then it will be attempted to place back in the pool, if it is in DontReuse the resource will be shutdown.
This pools internal guarantees are that the max number of values are in the pool at any time, not maximum number of operations. To do the latter application level bounds should be used.
A background reaper thread is kept alive for the length of the key pools life.
When resources are taken from the pool they are received as a Managed. This Managed has a Ref to a Reusable which indicates whether or not the pool can reuse the resource.
(I have a commented create function introducing this functionality here, so it may be introduced later.)