Return-Path: Delivered-To: apmail-myfaces-dev-archive@www.apache.org Received: (qmail 79710 invoked from network); 3 Apr 2008 20:10:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Apr 2008 20:10:03 -0000 Received: (qmail 8826 invoked by uid 500); 3 Apr 2008 20:09:58 -0000 Delivered-To: apmail-myfaces-dev-archive@myfaces.apache.org Received: (qmail 8777 invoked by uid 500); 3 Apr 2008 20:09:58 -0000 Mailing-List: contact dev-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list dev@myfaces.apache.org Received: (qmail 8735 invoked by uid 99); 3 Apr 2008 20:09:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2008 13:09:58 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2008 20:09:14 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 58129234C0B9 for ; Thu, 3 Apr 2008 13:07:24 -0700 (PDT) Message-ID: <474384957.1207253244359.JavaMail.jira@brutus> Date: Thu, 3 Apr 2008 13:07:24 -0700 (PDT) From: "Leonardo Uribe (JIRA)" To: dev@myfaces.apache.org Subject: [jira] Commented: (MYFACES-1796) FactoryFinder.releaseFactories() does not release application class loader. (PATCH available). In-Reply-To: <32981496.1199289934068.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/MYFACES-1796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12585268#action_12585268 ] Leonardo Uribe commented on MYFACES-1796: ----------------------------------------- Yes, the problem presented is clear. But I think that it is better to synchronize some parts of the code instead use synchronized HashMaps. The access to _registeredFactoryNames on getFactory must be synchronized to avoid effects. And the value retrieved through classLoader (a Map) must be cleaned for allow gc recolect memory. I will do more tests about this and commit a modifications of the proposal > FactoryFinder.releaseFactories() does not release application class loader. (PATCH available). > ---------------------------------------------------------------------------------------------- > > Key: MYFACES-1796 > URL: https://issues.apache.org/jira/browse/MYFACES-1796 > Project: MyFaces Core > Issue Type: Bug > Components: JSR-127 > Affects Versions: 1.1.5, 1.2.0 > Reporter: Konstantin Triger > Assignee: Leonardo Uribe > > FactoryFinder._registeredFactoryNames holds the Web application class loader as a key and thus prevents its collection when the application is undeployed. > The following patch fixes the issue (made in 1.1.5 branch): > Index: FactoryFinder.java > =================================================================== > --- FactoryFinder.java (revision 608034) > +++ FactoryFinder.java (working copy) > @@ -40,7 +40,7 @@ > public static final String LIFECYCLE_FACTORY = "javax.faces.lifecycle.LifecycleFactory"; > public static final String RENDER_KIT_FACTORY = "javax.faces.render.RenderKitFactory"; > - private static Map _registeredFactoryNames = new HashMap(); > + private static Map _registeredFactoryNames = Collections.synchronizedMap(new HashMap()); > /** > * Maps from classLoader to another map, the container (i.e. Tomcat) will create a class loader for > * each web app that it controls (typically anyway) and that class loader is used as the key. > @@ -49,7 +49,7 @@ > * that are created via getFactory. The instances will be of the class specified in the setFactory method > * for the factory name, i.e. FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, MyFactory.class). > */ > - private static Map _factories = new HashMap(); > + private static Map _factories = Collections.synchronizedMap(new HashMap()); > private static final Set VALID_FACTORY_NAMES = new HashSet(); > private static final Map ABSTRACT_FACTORY_CLASSES = new HashMap(); > @@ -222,6 +222,7 @@ > { > ClassLoader classLoader = getClassLoader(); > _factories.remove(classLoader); > + _registeredFactoryNames.remove(classLoader); > } > private static void checkFactoryName(String factoryName) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.