I have some code that uses "getChildrenNames", and this works well except when 
other threads via the same VM (or a remote one upon replication)  change the 
children a node has by removing or adding children.

The issue is that to use a set, you need to use an iterator.  When the 
underlying set is modified, the iterator properly throws a 
ConcurrentModificationException.  To avoid this, I attempted to use the 
"toArray" method on the returned set, but this suffers from the same problem.

In other code where I have used iterators, I have used the "clone" method to 
avoid this problem, but since the Set interface is returned by this method, I 
can not use that.  I tried to see the type actually returned through 
"getClass().getName()", but it is an UnmodifiableSet returned from the 
Collections class, and it does not implement Cloneable either.

Can anyone suggest a course of action to take?  I do not care if what I get 
back remains up to date as changes are made to the cache node, I only care that 
it is up-to-date when I invoke "getChildrenNames".

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

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


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to