[JBoss-dev] [JBossCache] - Re: Use of getChildrenNames
Bela wrote: anonymous wrote : Set children=new TreeSet(result), no need for a clone(). this must happen within the same transaction as getChildrennames(). If not using transactional locking there's still a chance that the Constructor of TreeSet will throw ConncurrentModificationException too. (It makes use of the Iterator of the 'result'). View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3856821#3856821 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3856821 --- 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
[JBoss-dev] [JBossCache] - Re: Use of getChildrenNames
Correction: can't remove Node from public exposure. Reason: interceptors in different packages use it, so the methods cannot be package-private. Bela View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3856830#3856830 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3856830 --- 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
[JBoss-dev] [JBossCache] - Re: Use of getChildrenNames
norbert wrote : This must happen within the same transaction as getChildrennames(). If not using transactional locking there's still a chance that the Constructor of TreeSet will throw ConncurrentModificationException too. (It makes use of the Iterator of the 'result'). Yeah, I noticed the same thing (after trying it). I am not using a transaction b/c this happens so infrequently, I am just retrying if I get the exception. It would be nice if you could do this without transactions (and not get the exception). View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3856892#3856892 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3856892 --- 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
[JBoss-dev] [JBossCache] - Re: Use of getChildrenNames
I just tracked this in the code - there seems to be no bug in this area. Threadsafe access to the keyset is garanteed by a ReadLock on the Node. The Concurrentmodificationexception should only be thrown, if 'getChildrenNames()' and the iteration over the keySet are not done within the same transaction. Access to the keySet outside of a transaction is not garanteed to be threadsafe. Can you please check out whether this still happens with TransactionIsolationLever being set higher than 'NONE'? View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3856661#3856661 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3856661 --- 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
[JBoss-dev] [JBossCache] - Re: Use of getChildrenNames
jiwils wrote : 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. Although the set in unmodifiable for the caller, the cache itself can modify it. You should copy the set immediately, e.g. Set children=new TreeSet(result), no need for a clone(). View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3856702#3856702 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3856702 --- 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
[JBoss-dev] [JBossCache] - Re: Use of getChildrenNames
I'm probably going to make all methods of Node package-private, b/c it doesnt make sense to expose Node to users anymore. Reason: we need to go through the interceptor stack, e.g. for locking, replication, cache loading etc, and if someone accesses a Node directly, they will bypass the stack. Bela View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3856814#3856814 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3856814 --- 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
[JBoss-dev] [JBossCache] - Re: Use of getChildrenNames
Although the methods of 'Node' are declared as public, this class is (currently) not intendet to be used directly by TreeCache-clients. The only way to access TreeCache in a threadsafe manner is through TreeCache's methods (put(), get() etc...) The methods of Node are not threadsafe. Whenever a method of Node is called the node is not locked in any way. Locking is being taken care of by the TreeCache itself. So you might ask, 'why are these methods declared as public?' - The only reason, that these methods are declared public, is, that you cannot declare classes to be 'friends' in java and Node is being used by other (internal) packages of JBossCache. (This packaging design might need some rework, or at least be somewhat better documented in the javadoc) View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3856616#3856616 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3856616 --- 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
[JBoss-dev] [JBossCache] - Re: Use of getChildrenNames
norbert wrote : Although the methods of 'Node' are declared as public, this class is (currently) not intendet to be used directly by TreeCache-clients. I am confused. The getChildrenNames method I referred to is on the TreeCache class, not the Node class. Does it still fall into the described not intended category? View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3856639#3856639 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3856639 --- 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