accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From milleruntime <>
Subject [GitHub] accumulo issue #292: ACCUMULO-4681 Created Table & Namespace WeakReference m...
Date Tue, 15 Aug 2017 16:04:34 GMT
Github user milleruntime commented on the issue:
    > This whole thing might be easier to implement with CacheBuilder.weakValues() from
Guava. Eviction seems to occur if value disappears. I think this will do what we want, and
it should automatically hide the WeakReference stuff from us, auto-evicting stuff when the
value is gone so we never see it as present in the map. The key can be String, without the
need to do any crazy new String stuff, or early construction. It ensures a dependency on Guava,
    This is the way I was leaning yesterday after reading that stackoverflow response.  I
think the issue with WeakHashMap is that they Keys are weak and not the values. So we have
to add another layer of WeakRefernce for the values, complicating things.  In our case, it
is just a cache and we really want weak values to store the ID objects.
    I also thought of still using WeakHashMap but flipping the keys and values - `WeakHashMap<AbstractId,
String>.`  Using ID as the key so it will automatically be weak and then I guess the canonical
String as the value.  But then the value is pretty useless.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message