[jboss-jira] [JBoss JIRA] (AS7-5714) JPA "Session Open Count" statistic appears to be bogus

Heiko Braun (JIRA) jira-events at lists.jboss.org
Thu Nov 8 05:45:18 EST 2012


     [ https://issues.jboss.org/browse/AS7-5714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Heiko Braun resolved AS7-5714.
------------------------------

    Fix Version/s: 7.2.0.Alpha1
                       (was: 7.2.0.CR1)
       Resolution: Done

    
> JPA "Session Open Count" statistic appears to be bogus
> ------------------------------------------------------
>
>                 Key: AS7-5714
>                 URL: https://issues.jboss.org/browse/AS7-5714
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: Console, JPA / Hibernate
>    Affects Versions: 7.1.2.Final (EAP)
>            Reporter: Jess Sightler
>            Assignee: Heiko Braun
>            Priority: Minor
>             Fix For: 7.2.0.Alpha1
>
>         Attachments: CDIHelloWorld.war, CDIHelloWorld.zip
>
>
> After running a small sample app, Session Open Count in the admin console displays 900006. Session close count is 1 (as expected). Memory usage does not significantly increase.
> The sample app exposes an EntityManager like this:
> @Produces
> public EntityManager getEntityManager() {
>     System.out.println("Getting entity manager!");
>     return entityManager;
> }
> A JAX-RS service then injects the entity manager, and performs a few simple queries:
> @Inject
> private EntityManager entityManager;
> @GET()
> @Produces("text/plain")
> public String sayHello() {
> 	try {
> 		userTransaction.begin();
> 		Car car = new Car();
> 		car.setCarName("Name: " + System.currentTimeMillis());
> 		entityManager.persist(car);
> 		
> 		Car car2 = new Car();
> 		car2.setCarName("Name: " + System.currentTimeMillis());
> 		entityManager.persist(car2);
> 		
> 		for (int i = 0; i < 900000; i++) {
> 			Query q = entityManager.createQuery("select c from Car c");
> 			List<Car> resultList = q.getResultList();
> 			for (Car c : resultList) {
>                 System.out.println("Car: " + c);
> 			}
> 		}
>     return "stub";
> }
> I don't see any way that this could actually be opening this many sessions.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list