As discussed in
POOL-277 there is some possibility to clean up the current StatsStore in impl/BaseGenericObjectPool. This would not only allow to get rid of the synchronized implementation and strange mean calculation, but also allow a user to register a faster or more complete statistics caluculation.
For this I would suggest to make a Statisctics interface public and allow the user to register implementations of this interface for the various tracked metrics.
This new interface should cover count, max, and mean. But the user can also directly use the object to ask it for percentile or other information.