persistence@glassfish.java.net

RE: Code review for issue 1003

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Wed, 30 Aug 2006 14:00:22 -0400

Hello Mitesh,
    This should be suffecient. We could move the code to createEntityManager instead of close(). That would ensure that the references are always cleaned up.
--Gordon

-----Original Message-----
From: Mitesh.Meswani_at_Sun.COM [mailto:Mitesh.Meswani_at_Sun.COM]On Behalf Of
Mitesh Meswani
Sent: Tuesday, August 29, 2006 8:58 PM
To: Gordon Yorke; Tom Ware
Cc: persistence_at_glassfish.dev.java.net
Subject: Code review for issue 1003


Hi Gordon,

Please find attached a fix for issue 1003
<https://glassfish.dev.java.net/issues/show_bug.cgi?id=1033>.
Following is a summary:
Changed the EntityManagerFactoryImpl.#entityManagers to be a linked list
Added a new method emClosed() to EntityManagerFactoryImpl. This method
is called from EntityManagerImpl.close(). The method iterates over the
list and cleans up as required.

Tests run:
A local test exercising the code.
Scott Oaks is running Specj with this code.

This bug is one of the show stoppers for the UR1 release which has a HCF
tomorrow (Wed). :(

Please note that the fix has a limitation of not cleaning up the list in
EntityManagerFactoryImpl if none of the ems of an application call
close(). The implementation to solve it is a bit more involved. At this
point I am wondering whether we need to maintain the list of
entitymanagers at all in. I can implement the involved fix if
maintaining the list is really required.

Thanks,
Mitesh