[concurrency-interest] Question: Concurrent Memoizer pattern with SoftHashMap
tim at peierls.net
Wed Jan 9 20:22:40 EST 2008
On Jan 9, 2008 4:54 PM, Kwok, Grace (MSCIBARRA) <Grace.Kwok at mscibarra.com>
> >>>>> [Tim Peierls wrote:] You could build a Memoizer from that [google's
> f I have a referenceMap with Strong key and Soft value combining with the
> memoizer pattern, the soft reference will be on the FutureTask. We would
> never have any hard reference to a FutureTask despite the fact that there
> might be additional hard reference to the value inside the FutureTask as it
> is returned. That means even if there is additional hard reference to the
> value inside the FutureTask as value is returned, the FutureTask itself
> (along with the value) inside the map is subject to garbage collection. That
> would not be what I want. Does anyone have suggestions of ways around it?
I didn't mean to use ReferenceMap<K, Future<V>>. Check out the Guice
ReferenceCache classes. They are internal to Guice, but they are close to
what you want.
It would be nice if the Guice ReferenceCache stuff were part of Google
Collections, hint hint.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest