Author: markt Date: Fri May 6 18:47:27 2016 New Revision: 1742589 URL: http://svn.apache.org/viewvc?rev=1742589&view=rev Log: Remove another unnecessary option from the memory leak protection
Modified: tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java tomcat/trunk/webapps/docs/changelog.xml 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=1742589&r1=1742588&r2=1742589&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java Fri May 6 18:47:27 2016 @@ -87,20 +87,6 @@ public class JreMemoryLeakPreventionList this.gcDaemonProtection = gcDaemonProtection; } - /** - * Protect against the memory leak caused when the first call to - * <code>javax.security.auth.Policy</code> is triggered by a web - * application. This first call populate a static variable with a reference - * to the context class loader. Defaults to <code>true</code>. - */ - private boolean securityPolicyProtection = true; - public boolean isSecurityPolicyProtection() { - return securityPolicyProtection; - } - public void setSecurityPolicyProtection(boolean securityPolicyProtection) { - this.securityPolicyProtection = securityPolicyProtection; - } - /** * Protects against the memory leak caused when the first call to * <code>javax.security.auth.login.Configuration</code> is triggered by a @@ -275,39 +261,6 @@ public class JreMemoryLeakPreventionList } /* - * Calling getPolicy retains a static reference to the context - * class loader. - */ - if (securityPolicyProtection) { - try { - // Policy.getPolicy(); - Class<?> policyClass = Class - .forName("javax.security.auth.Policy"); - Method method = policyClass.getMethod("getPolicy"); - method.invoke(null); - } catch(ClassNotFoundException e) { - // Ignore. The class is deprecated. - } catch(SecurityException e) { - // Ignore. Don't need call to getPolicy() to be - // successful, just need to trigger static initializer. - } catch (NoSuchMethodException e) { - log.warn(sm.getString("jreLeakListener.authPolicyFail"), - e); - } catch (IllegalArgumentException e) { - log.warn(sm.getString("jreLeakListener.authPolicyFail"), - e); - } catch (IllegalAccessException e) { - log.warn(sm.getString("jreLeakListener.authPolicyFail"), - e); - } catch (InvocationTargetException e) { - ExceptionUtils.handleThrowable(e.getCause()); - log.warn(sm.getString("jreLeakListener.authPolicyFail"), - e); - } - } - - - /* * Initializing javax.security.auth.login.Configuration retains a static reference to the context * class loader. */ Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1742589&r1=1742588&r2=1742589&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Fri May 6 18:47:27 2016 @@ -187,6 +187,12 @@ 7 onwards and Tomcat 9 requires Java 8 so the option is unnecessary. (markt) </scode> + <scode> + Remove the <code>securityPolicyProtection</code> option from the + <code>JreMemoryLeakPreventionListener</code>. The leak is fixed in Java + 8 onwards and Tomcat 9 requires Java 8 so the option is unnecessary. + (markt) + </scode> </changelog> </subsection> <subsection name="Coyote"> Modified: tomcat/trunk/webapps/docs/config/listeners.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/listeners.xml?rev=1742589&r1=1742588&r2=1742589&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/listeners.xml (original) +++ tomcat/trunk/webapps/docs/config/listeners.xml Fri May 6 18:47:27 2016 @@ -236,16 +236,6 @@ triggered by a web application. Defaults to <code>true</code>.</p> </attribute> - <attribute name="securityPolicyProtection" required="false"> - <p>Enables protection so that usage of the deprecated - <code>javax.security.auth.Policy</code> class by a web application does not - result in a memory leak. The first access of this class will trigger the - static initializer that will retain a static reference to the context - class loader. The protection calls the <code>getPolicy()</code> method - of this class to ensure that the static initializer is not triggered by - a web application. Defaults to <code>true</code>.</p> - </attribute> - <attribute name="tokenPollerProtection" required="false"> <p>Enables protection so that any token poller thread initialized by <code>sun.security.pkcs11.SunPKCS11.initToken()</code> does not --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org