Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 58837 invoked from network); 2 Aug 2007 00:00:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Aug 2007 00:00:47 -0000 Received: (qmail 47133 invoked by uid 500); 2 Aug 2007 00:00:47 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 47095 invoked by uid 500); 2 Aug 2007 00:00:47 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 47085 invoked by uid 99); 2 Aug 2007 00:00:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Aug 2007 17:00:47 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of plinskey@gmail.com designates 64.233.166.181 as permitted sender) Received: from [64.233.166.181] (HELO py-out-1112.google.com) (64.233.166.181) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Aug 2007 00:00:20 +0000 Received: by py-out-1112.google.com with SMTP id f31so621040pyh for ; Wed, 01 Aug 2007 17:00:21 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=mNIgsfHxcT5X6+AKRoHoTY3e8onnYkTecByg7xEnynR0npU17ycLghY+6m5QK0fIxqbgyMHYCqBorr10oiZSytP1Vwo/Vecuagsw5yPUYSGq1+AbDRhJ/+6V+LgHZgT2CCZyVcqi9nw2VsrKOw0UWy/NR0GxM3Gub2YIZJYmva0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=WFqQ663lNqlhZrBoy6ln26gyBEgD1DjDv8IDLC6Uxxw2nunA/nB0J90RJguW7zRxjNoPrsK06ey5hW3vCt7nOJEPtMl1+aR/EojNobvwHFJVvhsXfvutMUAK93lUvzXvh+hGJbTkUDWHhAjFyL8HixyOOV1m5s/Sk9nt+RaichY= Received: by 10.35.77.18 with SMTP id e18mr1825502pyl.1186012821534; Wed, 01 Aug 2007 17:00:21 -0700 (PDT) Received: by 10.35.100.9 with HTTP; Wed, 1 Aug 2007 17:00:21 -0700 (PDT) Message-ID: <7262f25e0708011700x1626ad8dtcb7bd7d8a4b3711b@mail.gmail.com> Date: Wed, 1 Aug 2007 17:00:21 -0700 From: "Patrick Linskey" To: dev@openjpa.apache.org Subject: Re: svn commit: r561970 - in /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa: enhance/PCRegistry.java util/ImplHelper.java In-Reply-To: <89c0c52c0708011533j6c96a5eob1185f3269fed205@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070801215558.02BEC1A981A@eris.apache.org> <3992B07C0590B548BB294D31768A1DA250BA28@repbex01.amer.bea.com> <89c0c52c0708011533j6c96a5eob1185f3269fed205@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org It would seem that we should be able to do something via EMF.close(). We'd probably want to do some sort of reference-counting to make sure that we didn't unregister types that shouldn't be unregistered yet, but it should be doable from there. -Patrick On 8/1/07, Kevin Sutter wrote: > Pinaki, > The Embedder of OpenJPA would have to call this method (ie. Geronimo, > WebSphere, WebLogic, etc). Any application server that embeds OpenJPA may > have to call this method if they run into this memory leak. From the > discussion on the dev mailing list, it sounds like this problem would be > pervasive across all application servers. Thus far, Geronimo is the only > one that has reported the problem. > > I realize that this is not ideal with the Embedder calling back into OpenJPA > to indicate that a classloader is no longer in service, but from the > discussions, it didn't sound like any other solution was going to suffice. > And, it sounded like from Don's last post on OPENJPA-285 that they were > getting antsy for some type of resolution. I figured that this change > resolves the situation for now and if we come up with something better or > more generic, then we can change it or add to it later. > > Kevin > > On 8/1/07, Pinaki Poddar wrote: > > > > Kevin, > > Who calls PCRegistry.deRegister(ClassLoader cl)? > > > > > > Pinaki Poddar > > 972.834.2865 > > > > -----Original Message----- > > From: kwsutter@apache.org [mailto:kwsutter@apache.org] > > Sent: Wednesday, August 01, 2007 4:56 PM > > To: commits@openjpa.apache.org > > Subject: svn commit: r561970 - in > > /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa: > > enhance/PCRegistry.java util/ImplHelper.java > > > > Author: kwsutter > > Date: Wed Aug 1 14:55:44 2007 > > New Revision: 561970 > > > > URL: http://svn.apache.org/viewvc?view=rev&rev=561970 > > Log: > > OPENJPA-285. I am going ahead with the integration of Kevan's patches > > for the two memory leaks found in OpenJPA while testing Geronimo. I > > will post more details in the Issue. > > > > Modified: > > > > openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PC > > Registry.java > > > > openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplH > > elper.java > > > > Modified: > > openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PC > > Registry.java > > URL: > > http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/ > > org/apache/openjpa/enhance/PCRegistry.java?view=diff&rev=561970&r1=56196 > > 9&r2=561970 > > ======================================================================== > > ====== > > --- > > openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PC > > Registry.java (original) > > +++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhanc > > +++ e/PCRegistry.java Wed Aug 1 14:55:44 2007 > > @@ -203,6 +203,23 @@ > > } > > > > /** > > + * De-Register all metadata associated with the given ClassLoader. > > + * Allows ClassLoaders to be garbage collected. > > + * > > + * @param cl the ClassLoader > > + */ > > + public static void deRegister(ClassLoader cl) { > > + synchronized (_metas) { > > + for (Iterator i = _metas.keySet().iterator(); i.hasNext();) > > { > > + Class pcClass = (Class) i.next(); > > + if (pcClass.getClassLoader() == cl) { > > + _metas.remove(pcClass); > > + } > > + } > > + } > > + } > > + > > + /** > > * Returns a collection of class objects of the registered > > * persistence-capable classes. > > */ > > > > Modified: > > openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplH > > elper.java > > URL: > > http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/ > > org/apache/openjpa/util/ImplHelper.java?view=diff&rev=561970&r1=561969&r > > 2=561970 > > ======================================================================== > > ====== > > --- > > openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplH > > elper.java (original) > > +++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/I > > +++ mplHelper.java Wed Aug 1 14:55:44 2007 > > @@ -39,7 +39,6 @@ > > import org.apache.openjpa.lib.util.Closeable; > > import org.apache.openjpa.lib.util.ReferenceMap; > > import org.apache.openjpa.lib.util.UUIDGenerator; > > -import org.apache.openjpa.lib.util.concurrent.ConcurrentHashMap; > > import > > org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashMap; > > import org.apache.openjpa.meta.ClassMetaData; > > import org.apache.openjpa.meta.FieldMetaData; > > @@ -244,7 +243,8 @@ > > Boolean isAssignable = null; > > Map assignableTo = (Map) _assignableTypes.get(from); > > if (assignableTo == null) { // "to" cache doesn't exist, so > > create it... > > - assignableTo = new ConcurrentHashMap(); > > + assignableTo = new > > ConcurrentReferenceHashMap(ReferenceMap.WEAK, > > + ReferenceMap.HARD); > > _assignableTypes.put(from, assignableTo); > > } else { // "to" cache exists... > > isAssignable = (Boolean) assignableTo.get(to); > > > > > > > > Notice: This email message, together with any attachments, may contain > > information of BEA Systems, Inc., its subsidiaries and affiliated > > entities, that may be confidential, proprietary, copyrighted and/or > > legally privileged, and is intended solely for the use of the individual or > > entity named in this message. If you are not the intended recipient, and > > have received this message in error, please immediately return this by email > > and then delete it. > > > -- Patrick Linskey 202 669 5907