myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r958781 - /myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/util/StreamingDestroyerListener.java
Date Mon, 28 Jun 2010 23:15:55 GMT
Author: lu4242
Date: Mon Jun 28 23:15:55 2010
New Revision: 958781

URL: http://svn.apache.org/viewvc?rev=958781&view=rev
Log:
TOMAHAWK-1443 StreamingAddResource introduces memory leak (only activate if StreamingAddResource
is used)

Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/util/StreamingDestroyerListener.java

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/util/StreamingDestroyerListener.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/util/StreamingDestroyerListener.java?rev=958781&r1=958780&r2=958781&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/util/StreamingDestroyerListener.java
(original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/util/StreamingDestroyerListener.java
Mon Jun 28 23:15:55 2010
@@ -21,15 +21,23 @@ package org.apache.myfaces.component.htm
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 
+import org.apache.myfaces.shared_tomahawk.config.MyfacesConfig;
+
 public class StreamingDestroyerListener implements ServletContextListener 
 {
 
     public void contextInitialized(ServletContextEvent event)
     {
-        StreamingThreadManager manager = new StreamingThreadManager();
-        event.getServletContext().setAttribute(StreamingThreadManager.KEY,
-                manager);
-        manager.init();
+        //Only initialize a StreamingThreadManager if StreamingAddResource is used
+        String addResourceClass = MyfacesConfig.getAddResourceClassFromServletContext(event.getServletContext());
+        
+        if (addResourceClass != null && addResourceClass.equals(StreamingAddResource.class.getName()))
+        {
+            StreamingThreadManager manager = new StreamingThreadManager();
+            event.getServletContext().setAttribute(StreamingThreadManager.KEY,
+                    manager);
+            manager.init();
+        }
     }
 
     public void contextDestroyed(ServletContextEvent event)



Mime
View raw message