-
Bug
-
Resolution: Done
-
Minor
-
7.1.2.Final (EAP)
-
None
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)
}
return "stub";
}
I don't see any way that this could actually be opening this many sessions.