[infinispan-dev] keySet(), values() and entrySet() not implemented

Manik Surtani manik at jboss.org
Thu Jun 4 05:14:11 EDT 2009


+1.

Implementing these naively is easy; anything else is much harder.   
Here are some basic thoughts.

If we are in LOCAL or REPL mode, this is straightforward *if* we  
ignore cache stores.  If we take cache stores or DIST into account, we  
have the potential for instant OOMs.  Even if we use custom  
collections that load lazily from a store or across a cluster, the  
collections still need to efficiently handle contains(), size(), etc.

Perhaps we should just limit these to reporting what is local, and in- 
memory only.  Clearly Javadoc'ed, of course, to detail these  
limitations - along with a general recommendation that these are  
inherited from ConcurrentMap and not expected to be used in any  
extensive or meaningful way.

A few other thoughts (and these should be javadoc'ed too):

* These collections should always be immutable
* These methods do not participate in any transactions



On 4 Jun 2009, at 09:47, Galder Zamarreno wrote:

> Hi,
>
> keySet(), values(), entrySet() do not seem to be implemented at the  
> moment:
>
>   public Set<K> keySet() {
>      throw new UnsupportedOperationException("TODO implement  
> me"); // TODO implement me
>   }
>
>   public Collection<V> values() {
>      throw new UnsupportedOperationException("TODO implement  
> me"); // TODO implement me
>   }
>
>   public Set<Map.Entry<K, V>> entrySet() {
>      throw new UnsupportedOperationException("TODO implement  
> me"); // TODO implement me
>   }
>
> We should be implementing these methods, shouldn't we? Users might  
> want to iterate the map for example to print the contents or to  
> verify it contains what they put on it...etc.
>
> I can't see a JIRA for it, so I'll open one so that this gets  
> implemented for Beta1 unless someone has any objections.
>
> On IRC, Mircea said it might very costly, specially for dist, but we  
> still need it regardless, otherwise we're not fully implementing the  
> ConcurrentMap interface and these are commonly used methods.
>
> Regards,
> -- 
> Galder Zamarreño
> Sr. Software Maintenance Engineer
> JBoss, a division of Red Hat
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Manik Surtani
manik at jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org








More information about the infinispan-dev mailing list