[ https://issues.apache.org/jira/browse/OPENJPA-2767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16964967#comment-16964967 ]
Will Dazey commented on OPENJPA-2767: ------------------------------------- I am adding back the extra synchronization to `MetaDataRepository.processRegisteredClasses()` for `_registered` so that `MetaDataRepository.register()` can safely add to `_registered`. This synchronization block was in the original code, but was removed in the previous fix as I thought method synchronization was enough. This was an oversight in my previous fix and I shouldn't have removed that sync block. Exception: ``` Caused by: java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextNode(HashMap.java:1456) at java.util.HashMap$KeyIterator.next(HashMap.java:1480) at java.util.AbstractCollection.finishToArray(AbstractCollection.java:243) at java.util.AbstractCollection.toArray(AbstractCollection.java:210) at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClasses(MetaDataRepository.java:1638) at org.apache.openjpa.meta.ClassMetaData.getPCSubclasses(ClassMetaData.java:377) ``` Due to the difficulties in testing these race conditions, I did not include a test with the patch. However, for what it is worth, the patch was tested in an application server getting these intermittent ConcurrentModificationExceptions and they noticed them go away. I am currently having our performance team make sure performance is not negatively impacted by this change. > Incomplete ValueMapDiscriminatorStrategy cache > ----------------------------------------------- > > Key: OPENJPA-2767 > URL: https://issues.apache.org/jira/browse/OPENJPA-2767 > Project: OpenJPA > Issue Type: Bug > Reporter: Will Dazey > Assignee: Will Dazey > Priority: Minor > Fix For: 2.2.3, 3.1.1 > > Attachments: OJ2767_2.2.x_v4.patch, OJ2767_2.2.x_v4_p2.patch > > Time Spent: 1h 40m > Remaining Estimate: 0h > > There exists the possibility that the discriminator class cache in > ValueMapDiscriminatorStrategy was originally created before the server fully > loaded all classes. If this happens, the cache is incomplete and needs to be > rebuilt. A simple enough strategy would be to just try rebuilding the cache, > before giving up and throwing a CNFE, and check again. -- This message was sent by Atlassian Jira (v8.3.4#803005)