[jboss-user] [JBoss Cache: Core Edition] - Re: Getting data from a node

FredrikJ do-not-reply at jboss.com
Wed Apr 30 05:15:28 EDT 2008


The returned map from the node seems to be an instance of java.util.Collections$UnmodifiableMap. The javadoc for the UnmodifiableMap specifies:

anonymous wrote : unmodifiableMap
  | 
  | public static <K,V> Map<K,V> unmodifiableMap(Map<? extends K,? extends V> m)
  | 
  |     Returns an unmodifiable view of the specified map. This method allows modules to provide users with "read-only" access to internal maps. Query operations on the returned map "read through" to the specified map, and attempts to modify the returned map, whether direct or via its collection views, result in an UnsupportedOperationException.
  | 
  |     The returned map will be serializable if the specified map is serializable.
  | 
  |     Parameters:
  |         m - the map for which an unmodifiable view is to be returned. 
  |     Returns:
  |         an unmodifiable view of the specified map.

I would say it is plausible that the unmodifiedMap provides an immutable view but is still backed by a map which will reflect changes to the underlying data thus creating a map which is not safe to iterate in concurrent situations. 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4147756#4147756

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4147756



More information about the jboss-user mailing list