[jboss-dev-forums] [Design of JBossCache] - Re: API Issues integrating 2.0.0.DR1 in HEAD

manik.surtani@jboss.com do-not-reply at jboss.com
Wed Oct 18 07:44:52 EDT 2006


anonymous wrote : 
  | The concern I have re: thread safety is if a collection backed by the internal data structure of a node is exposed, you can get a ConcurrentModificationException just iterating over it. Not sure if that really happens. I saw NodeImpl.getDataKeys() exposes a collection backed by the data map. Haven't followed the code to see what happens to it. But, if that gets passed to a caller, any lock on the node could easily be released before the collection is even received by the caller (assume no tx). Thus easy to have another thread modify the data map via a put/remove while the first thread is iterating. Actually, as I write this, if what I'm describing is there, it's not a javadoc issue, it's something that needs to be changed.
  | 

getKeys() and getData() currently return unmodifiable maps based on the internal data structures in a node.  I see your point about CMEs.  This would have to be a simple copy I suppose, but I'm not too keen on the performance overhead of this copy.  It seems to be the most 'correct' thing to do though.


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

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



More information about the jboss-dev-forums mailing list