griffinjm commented on code in PR #672:
URL: 
https://github.com/apache/commons-collections/pull/672#discussion_r2977335863


##########
src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java:
##########
@@ -437,6 +437,160 @@ void testPrefixMapSizes2() {
         assertTrue(trie.prefixMap(prefixString).containsKey(longerString));
     }
 
+    @Test

Review Comment:
   The issue is the bug is only visible when 2 threads are iterating the Trie. 
While it's not advertised as threadsafe per se, I'd argue that 2 threads simply 
iterating the Trie in a read-only fashion should not result in a CME. I can 
iterate all of the standard Java collections with multiple iterators and not 
have a CME unless another thread explicitly modifies the shared collection. But 
here the modification happens silently internally in the Trie and it is 
returned to the original state afterwards, it was a temporary hack in the 
initial implementation.
   
   ```
   TrieEntry<K, V> ceilingEntry(final K key) {
   // TODO: Cleanup so that we don't actually have to add/remove from the
   //       tree.  (We do it here because there are other well-defined
   //       functions to perform the search.) 
   ...
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to