From: schultz sun.java2d.Disposer class is loaded by a web application.
+ * Defaults to false because a new Thread is launched.
+ */
+ private boolean java2dDisposerProtection = false;
+ public boolean isJava2DDisposerProtection() {
+ return java2dDisposerProtection;
+ }
+ public void setJava2DDisposerProtection(boolean java2dDisposerProtection) {
+ this.java2dDisposerProtection = java2dDisposerProtection;
+ }
+
+ /**
* Protect against the memory leak caused when the first call to
* sun.misc.GC.requestLatency(long) is triggered by a web
* application. This first call will start a GC Daemon thread with the
@@ -237,6 +250,18 @@ public class JreMemoryLeakPreventionListener implements LifecycleListener {
java.awt.Toolkit.getDefaultToolkit();
}
+ // Trigger the creation of the "Java2D Disposer" thread.
+ // See https://issues.apache.org/bugzilla/show_bug.cgi?id=51687
+ if(java2dDisposerProtection) {
+ try {
+ Class.forName("sun.java2d.Disposer");
+ }
+ catch (ClassNotFoundException cnfe) {
+ // Ignore this case: we must be running on a
+ // non-Sun-based JRE.
+ }
+ }
+
/*
* Several components end up calling:
* sun.misc.GC.requestLatency(long)
diff --git a/webapps/docs/config/listeners.xml b/webapps/docs/config/listeners.xml
index 1900e7b99..7044eff49 100644
--- a/webapps/docs/config/listeners.xml
+++ b/webapps/docs/config/listeners.xml
@@ -199,6 +199,13 @@
startup on non-Sun JVMs. The default is true.
Enables protection so that loading the
+ sun.java2d.Disposer class by a web application does not
+ result in a memory leak.
+ Defaults to false because a thread is launched.
Enables protection so that the PoolCleaner thread started by
com.sun.jndi.ldap.LdapPoolManager does not result in a