From: kkolinko java.awt.Toolkit.getDefaultToolkit() is triggered
+ * by a web application. Defaults to false because a new
+ * Thread is launched.
+ */
+ private boolean awtThreadProtection = false;
+ public boolean isAWTThreadProtection() { return awtThreadProtection; }
+ public void setAWTThreadProtection(boolean awtThreadProtection) {
+ this.awtThreadProtection = awtThreadProtection;
+ }
+
/**
* Protect against the memory leak caused when the first call to
* sun.misc.GC.requestLatency(long) is triggered by a web
@@ -218,7 +230,13 @@ public class JreMemoryLeakPreventionListener implements LifecycleListener {
if (appContextProtection) {
ImageIO.getCacheDirectory();
}
-
+
+ // Trigger the creation of the AWT (AWT-Windows, AWT-XAWT,
+ // etc.) thread
+ if (awtThreadProtection) {
+ java.awt.Toolkit.getDefaultToolkit();
+ }
+
/*
* 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 8d148e4a9..1900e7b99 100644
--- a/webapps/docs/config/listeners.xml
+++ b/webapps/docs/config/listeners.xml
@@ -174,6 +174,13 @@
is true.
Enables protection so that calls to
+ java.awt.Toolkit.getDefaultToolkit() triggered by a web
+ application do not result in a memory leak.
+ Defaults to false because an AWT thread is launched.
The first use of java.sql.DriverManager will trigger the
loading of JDBNC Driver in the the current class loader. The web