commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Holger Hoffstaette" <>
Subject [pool] GenericKeyedObjectPool, WHEN_EXHAUSTED_BLOCK & multiple threads
Date Sat, 28 Oct 2006 14:49:31 GMT

I'm having a bit of a problem understanding a scenario for
GenericKeyedObjectPool. I need to WHEN_EXHAUSTED_BLOCK with a GKOP that is
used from multiple threads, but I cannot see how a blocking borrow(key)
can ever continue when another thread tries to returnObject(key, object),
as the methods are synchronized on the pool instance and would mutually
exclude each other?

Since I only need to block on a keys queue and not on the whole pool -
assuming I'm within the min/max limits - the only way around this seems to
be something like a ConcurrentKeyedObjectPool that does not synchronize
for the top-level map access but rather only on the second-level queue,
right? I was hoping to avoid that since it greatly complicates matters
regarding the pool's overall resource handling.


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

View raw message