commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <>
Subject Re: [Pool2] Alternative identity hashmap pool implementations
Date Fri, 06 Feb 2015 19:58:06 GMT
On 2/6/15 11:56 AM, sebb wrote:
> There seem to be a few use-cases for pools that always treat different
> instances as different entries, rather than using the current equals()
> check.

> Would it make sense to implement alternative versions that accept an
> object and wrap it in a class that implements equals() using == and
> System.identityHashcode?

Yes, we should definitely support this use case.
> The IdentityWrapper class was suggested here:
> I think it could be done by subclassing the existing implementations
> to provide the wrapping/unwrapping support.
> There would be an overhead because the wrappers would need to be
> created every time an object was passed in. The wrappers are very
> small.

Once I get the DBCP release I am working on out, I plan to explore
all three alternatives in my comment on POOL-284.  The performance
regression testing tool that Thomas found and referenced on that
ticket looks very interesting and could help assessing the cost of
wrapping / unwrapping or changing the current impl to use
sync-protected IdentityHashMap.  If we can get a solution that "just
works" at demonstrably very low cost, I will advocate for that.  If
not, then probably what you are describing above, made available
like other custom pools via PoolUtils, makes sense.

> S.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> .

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message