When I create two EntityManagerFactories in two different threads, I get the following 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)
|