[
https://issues.apache.org/jira/browse/TAP5-2499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kalle Korhonen reassigned TAP5-2499:
------------------------------------
Assignee: Kalle Korhonen
> Race condition in EntityManagerSource#getEntityManagerFactory
> -------------------------------------------------------------
>
> Key: TAP5-2499
> URL: https://issues.apache.org/jira/browse/TAP5-2499
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-jpa
> Affects Versions: 5.4, 5.3.8
> Reporter: Dmitry Gusev
> Assignee: Kalle Korhonen
>
> On application start if more than one thread needs an entity manager more
> than one instance of EntityManagerFactory may be created.
> This is undesirable, because EMF may use a connection pool and creating more
> than one instance will lead to too many open database connections.
> EntityManagerSourceImpl.java:
> {code}
> public EntityManagerFactory getEntityManagerFactory(final String
> persistenceUnitName)
> {
> EntityManagerFactory emf =
> entityManagerFactories.get(persistenceUnitName);
> if (emf == null)
> {
> emf = createEntityManagerFactory(persistenceUnitName);
> entityManagerFactories.put(persistenceUnitName, emf);
> }
> return emf;
> }
> {code}
> Above code needs some synchronization.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)