[hibernate-issues] [Hibernate-JIRA] Commented: (EJB-457) ConcurrentModificationException when initializing unrelated EntityManagerFactories in two different threads
Kenneth Flynn (JIRA)
noreply at atlassian.com
Sun Aug 2 03:27:14 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/EJB-457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33693#action_33693 ]
Kenneth Flynn commented on EJB-457:
-----------------------------------
Okay, somehow I pressed enter before typing the rest of the issue. Rest of the description here,..
When I create two EntityManagerFactories in two different threads, I get the stacktrace below. It looks like I'm determining the persistence provider implementations twice at the same time; the static set in the Persistence class is not thread safe; in particular findAllProviders() fails if it is called concurrently. In this case, the use of the persistence api in the two different threads is completely unrelated--they are using different persistence units, different dbs, etc. This seems like a use case that should be supported?
[java] java.util.ConcurrentModificationException
[java] at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
[java] at java.util.HashMap$KeyIterator.next(HashMap.java:828)
[java] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
[java] at com.darkcorner.minotaur.sa.redline.RedlineDatabaseControl.ensureRunning(RedlineDatabaseControl.java:101)
[java] at com.darkcorner.minotaur.sa.redline.RedlineService.restartService(RedlineService.java:316)
[java] at com.darkcorner.harmonice.ServiceHandler.callRestart(ServiceHandler.java:241)
[java] at com.darkcorner.harmonice.ServiceHandler.access$000(ServiceHandler.java:56)
[java] at com.darkcorner.harmonice.ServiceHandler$RestartTask.run(ServiceHandler.java:63)
[java] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
[java] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
[java] at java.util.concurrent.FutureTask.run(FutureTask.java:138)
[java] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
[java] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[java] at java.lang.Thread.run(Thread.java:619)
> ConcurrentModificationException when initializing unrelated EntityManagerFactories in two different threads
> -----------------------------------------------------------------------------------------------------------
>
> Key: EJB-457
> URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-457
> Project: Hibernate Entity Manager
> Issue Type: Bug
> Components: EntityManager
> Affects Versions: 3.4.0.GA
> Reporter: Kenneth Flynn
>
> I get the following:
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list