tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TAP5-2499) Race condition in EntityManagerSource#getEntityManagerFactory
Date Tue, 15 Mar 2016 00:10:34 GMT

    [ https://issues.apache.org/jira/browse/TAP5-2499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15194434#comment-15194434
] 

Hudson commented on TAP5-2499:
------------------------------

FAILURE: Integrated in tapestry-trunk-freestyle #1563 (See [https://builds.apache.org/job/tapestry-trunk-freestyle/1563/])
FIXED - TAP5-2499: Race condition in (kaosko: rev 940bd2a51df3a96c14da7d1a861f387820b65efe)
* tapestry-jpa/src/main/java/org/apache/tapestry5/internal/jpa/EntityManagerSourceImpl.java


> 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
>             Fix For: 5.4.1
>
>
> 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)

Mime
View raw message