You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/04/18 18:06:43 UTC
svn commit: r1739780 - in /tomcat/trunk:
java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
webapps/docs/config/listeners.xml
Author: markt
Date: Mon Apr 18 16:06:43 2016
New Revision: 1739780
URL: http://svn.apache.org/viewvc?rev=1739780&view=rev
Log:
Remove work-around for leak that is fixed in all Java 8 versions.
Modified:
tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
tomcat/trunk/webapps/docs/config/listeners.xml
Modified: tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java?rev=1739780&r1=1739779&r2=1739780&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java Mon Apr 18 16:06:43 2016
@@ -26,7 +26,6 @@ import java.net.URLConnection;
import java.sql.DriverManager;
import java.util.StringTokenizer;
-import javax.imageio.ImageIO;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -65,20 +64,6 @@ public class JreMemoryLeakPreventionList
/**
* Protect against the memory leak caused when the first call to
- * <code>sun.awt.AppContext.getAppContext()</code> is triggered by a web
- * application. Defaults to <code>false</code> since
- * {@link java.beans.Introspector#flushCaches()} no longer uses AppContext
- * from 1.7.0_02 onwards. Also, from 1.7.0_25 onwards, calling this method
- * requires a graphical environment and starts an AWT thread.
- */
- private boolean appContextProtection = false;
- public boolean isAppContextProtection() { return appContextProtection; }
- public void setAppContextProtection(boolean appContextProtection) {
- this.appContextProtection = appContextProtection;
- }
-
- /**
- * Protect against the memory leak caused when the first call to
* <code>java.awt.Toolkit.getDefaultToolkit()</code> is triggered
* by a web application. Defaults to <code>false</code> because a new
* Thread is launched.
@@ -249,32 +234,6 @@ public class JreMemoryLeakPreventionList
DriverManager.getDrivers();
}
- /*
- * Several components end up calling:
- * sun.awt.AppContext.getAppContext()
- *
- * Those libraries / components known to trigger memory leaks
- * due to eventual calls to getAppContext() are:
- * - Google Web Toolkit via its use of javax.imageio
- * - Tomcat via its use of java.beans.Introspector.flushCaches()
- * in 1.7.0 to 1.7.0_01. From 1.7.0_02 onwards use of
- * AppContext by Introspector.flushCaches() was replaced with
- * ThreadGroupContext
- * - others TBD
- *
- * From 1.7.0_25 onwards, a call to
- * sun.awt.AppContext.getAppContext() results in a thread being
- * started named AWT-AppKit that requires a graphic environment
- * to be available.
- */
-
- // Trigger a call to sun.awt.AppContext.getAppContext(). This
- // will pin the system class loader in memory but that shouldn't
- // be an issue.
- if (appContextProtection) {
- ImageIO.getCacheDirectory();
- }
-
// Trigger the creation of the AWT (AWT-Windows, AWT-XAWT,
// etc.) thread
if (awtThreadProtection) {
Modified: tomcat/trunk/webapps/docs/config/listeners.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/listeners.xml?rev=1739780&r1=1739779&r2=1739780&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/listeners.xml (original)
+++ tomcat/trunk/webapps/docs/config/listeners.xml Mon Apr 18 16:06:43 2016
@@ -178,15 +178,6 @@
<attributes>
- <attribute name="appContextProtection" required="false">
- <p>Enables protection so that calls to
- <code>sun.awt.AppContext.getAppContext()</code> triggered by a web
- application do not result in a memory leak. Note that enabling this
- protection will trigger a requirement for a graphical environment unless
- Java is started in head-less mode. The default is <code>false</code>.
- </p>
- </attribute>
-
<attribute name="AWTThreadProtection" required="false">
<p>Enables protection so that calls to
<code>java.awt.Toolkit.getDefaultToolkit()</code> triggered by a web
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org