Hi Bryan,
See how it works with thread pool especially if you use one of the lock free structures to
create a pool. My bet is that a ConcurrentLinkedQueue would be a good candidate. I'll
commit BufferedConcurrentHashMap probably in a week or so. Ideally we can then compare
BufferedConcurrentHashMap with thread pool approach.
Regards,
Vladimir
On 2010-01-27, at 7:00 PM, Bryan Thompson wrote:
So, overall, this approach is working out very nicely for us in combination with
WeakReferences. One drawback of the approach is that hard references remain in the
thread-local arrays until they are batched through the lock. Depending on how threads are
managed, it is possible for hard references to remain in the thread local queues long past
their last touch. For this reason we do not use this technique when the cache contains
expensive resources where we need a better guarantee of timely discard when they resource
is no longer in use by the application. It might be possible to address this concern
with a protocol to attach and detach the thread-local buffers from threads on their way
into / out of a thread pool.