[jboss-jira] [JBoss JIRA] (AS7-5714) JPA "Session Open Count" statistic appears to be bogus
Scott Marlow (JIRA)
jira-events at lists.jboss.org
Tue Oct 16 12:08:01 EDT 2012
[ https://issues.jboss.org/browse/AS7-5714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12726925#comment-12726925 ]
Scott Marlow commented on AS7-5714:
-----------------------------------
I just ran the test app and am using jboss-cli.sh
{quote}
./jboss-cli.sh
connect
cd /deployment=CDIHelloWorld.war/subsystem=jpa/hibernate-persistence-unit=CDIHelloWorld.war#CDIHelloWorld
ls
{quote}
Output of the "ls" command is:
{quote}
cd CDIHelloWorld.war#CDIHelloWorld
[standalone at localhost:9999 hibernate-persistence-unit=CDIHelloWorld.war#CDIHelloWorld] ls
collection entity-update-count=0
entity flush-count=1
entity-cache optimistic-failure-count=0
query-cache prepared-statement-count=900006
close-statement-count=0 query-cache-hit-count=0
collection-fetch-count=0 query-cache-miss-count=0
collection-load-count=0 query-cache-put-count=0
collection-recreated-count=0 query-execution-count=900004
collection-remove-count=0 query-execution-max-time=17
collection-update-count=0 query-execution-max-time-query-string=select c from Car c
completed-transaction-count=1 scoped-unit-name=CDIHelloWorld.war#CDIHelloWorld
connect-count=900006 second-level-cache-hit-count=0
enabled=true second-level-cache-miss-count=0
entity-delete-count=0 second-level-cache-put-count=0
entity-fetch-count=0 session-close-count=1
entity-insert-count=2 session-open-count=1
entity-load-count=0 successful-transaction-count=1
{quote}
It looks like the admin console is showing the connection count incorrectly. As a workaround, use the jboss-cli.sh to get the proper statistics.
The admin console should show { connect-count=900006, session-close-count=1, session-open-count=1}, but instead shows { Session Open Count 900006, Session Close Count 1, Connection Count 1}
> 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: JPA / Hibernate
> Affects Versions: 7.1.2.Final (EAP)
> Reporter: Jess Sightler
> Assignee: Scott Marlow
> Priority: Minor
> 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