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.2.0, 1.1.5
            Reporter: Konstantin Triger


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.

Reply via email to