Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3971A9726 for ; Wed, 1 Feb 2012 11:33:24 +0000 (UTC) Received: (qmail 75957 invoked by uid 500); 1 Feb 2012 11:33:23 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 75701 invoked by uid 500); 1 Feb 2012 11:33:22 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 75540 invoked by uid 99); 1 Feb 2012 11:33:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Feb 2012 11:33:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Feb 2012 11:33:18 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 96BC723888E4 for ; Wed, 1 Feb 2012 11:32:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1239082 - in /tomcat/trunk/java/org/apache/catalina: core/LocalStrings.properties core/StandardContext.java loader/WebappLoader.java Date: Wed, 01 Feb 2012 11:32:57 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120201113257.96BC723888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: markt Date: Wed Feb 1 11:32:56 2012 New Revision: 1239082 URL: http://svn.apache.org/viewvc?rev=1239082&view=rev Log: Remove dependency on StandardContext from WebappLoader Modified: tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties tomcat/trunk/java/org/apache/catalina/core/StandardContext.java tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java Modified: tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties?rev=1239082&r1=1239081&r2=1239082&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties Wed Feb 1 11:32:56 2012 @@ -123,6 +123,7 @@ standardContext.startFailed=Context [{0} standardContext.startingContext=Exception starting Context with name [{0}] standardContext.stoppingContext=Exception stopping Context with name [{0}] standardContext.urlPattern.patternWarning=WARNING: URL pattern {0} must start with a ''/'' in Servlet 2.4 +standardContext.webappClassLoader.missingProperty=Unable to set the web application class loader property [{0}] to [{1}] as the property does not exist. standardContext.workPath=Exception obtaining work path for context [{0}] standardContext.workCreateException=Failed to determine absolute work directory from directory [{0}] and CATALINA_HOME [{1}] for context [{2}] standardContext.workCreateFail=Failed to create work directory [{0}] for context [{1}] Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1239082&r1=1239081&r2=1239082&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Wed Feb 1 11:32:56 2012 @@ -116,6 +116,7 @@ import org.apache.naming.resources.WARDi import org.apache.tomcat.InstanceManager; import org.apache.tomcat.JarScanner; import org.apache.tomcat.util.ExceptionUtils; +import org.apache.tomcat.util.IntrospectionUtils; import org.apache.tomcat.util.modeler.Registry; import org.apache.tomcat.util.scan.StandardJarScanner; @@ -5032,6 +5033,16 @@ public class StandardContext extends Con // since the loader just started, the webapp classloader is now // created. + setClassLoaderProperty("antiJARLocking", getAntiJARLocking()); + setClassLoaderProperty("clearReferencesStatic", + getClearReferencesStatic()); + setClassLoaderProperty("clearReferencesStopThreads", + getClearReferencesStopThreads()); + setClassLoaderProperty("clearReferencesStopTimerThreads", + getClearReferencesStopTimerThreads()); + setClassLoaderProperty("clearReferencesHttpClientKeepAliveThread", + getClearReferencesHttpClientKeepAliveThread()); + // By calling unbindThread and bindThread in a row, we setup the // current Thread CCL to be the webapp classloader unbindThread(oldCCL); @@ -5232,6 +5243,16 @@ public class StandardContext extends Con } } + private void setClassLoaderProperty(String name, boolean value) { + ClassLoader cl = getLoader().getClassLoader(); + if (IntrospectionUtils.setProperty(cl, name, Boolean.toString(value))) { + // Failed to set + log.info(sm.getString( + "standardContext.webappClassLoader.missingProperty", + name, Boolean.toString(value))); + } + } + private Map> buildInjectionMap(NamingResources namingResources) { Map> injectionMap = new HashMap>(); for (Injectable resource: namingResources.findLocalEjbs()) { Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java?rev=1239082&r1=1239081&r2=1239082&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java (original) +++ tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java Wed Feb 1 11:32:56 2012 @@ -53,7 +53,6 @@ import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleState; import org.apache.catalina.Loader; -import org.apache.catalina.core.StandardContext; import org.apache.catalina.mbeans.MBeanUtils; import org.apache.catalina.util.LifecycleMBeanBase; import org.apache.naming.resources.DirContextURLStreamHandler; @@ -402,8 +401,8 @@ public class WebappLoader extends Lifecy try { Thread.currentThread().setContextClassLoader (WebappLoader.class.getClassLoader()); - if (container instanceof StandardContext) { - ((StandardContext) container).reload(); + if (container instanceof Context) { + ((Context) container).reload(); } } finally { if (container.getLoader() != null) { @@ -564,19 +563,6 @@ public class WebappLoader extends Lifecy classLoader.setResources(container.getResources()); classLoader.setDelegate(this.delegate); classLoader.setSearchExternalFirst(searchExternalFirst); - if (container instanceof StandardContext) { - classLoader.setAntiJARLocking( - ((StandardContext) container).getAntiJARLocking()); - classLoader.setClearReferencesStatic( - ((StandardContext) container).getClearReferencesStatic()); - classLoader.setClearReferencesStopThreads( - ((StandardContext) container).getClearReferencesStopThreads()); - classLoader.setClearReferencesStopTimerThreads( - ((StandardContext) container).getClearReferencesStopTimerThreads()); - classLoader.setClearReferencesHttpClientKeepAliveThread( - ((StandardContext) container).getClearReferencesHttpClientKeepAliveThread()); - } - for (int i = 0; i < repositories.length; i++) { classLoader.addRepository(repositories[i]); } @@ -593,14 +579,14 @@ public class WebappLoader extends Lifecy DirContextURLStreamHandler.bind(classLoader, this.container.getResources()); - StandardContext ctx=(StandardContext)container; - String contextName = ctx.getName(); + String contextName = container.getName(); if (!contextName.startsWith("/")) { contextName = "/" + contextName; } - ObjectName cloname = new ObjectName - (MBeanUtils.getDomain(ctx) + ":type=WebappClassLoader,context=" - + contextName + ",host=" + ctx.getParent().getName()); + ObjectName cloname = new ObjectName( + MBeanUtils.getDomain(container) + + ":type=WebappClassLoader,context=" + contextName + + ",host=" + container.getParent().getName()); Registry.getRegistry(null, null) .registerComponent(classLoader, cloname, null); @@ -642,14 +628,14 @@ public class WebappLoader extends Lifecy DirContextURLStreamHandler.unbind(classLoader); try { - StandardContext ctx=(StandardContext)container; - String contextName = ctx.getName(); + String contextName = container.getName(); if (!contextName.startsWith("/")) { contextName = "/" + contextName; } - ObjectName cloname = new ObjectName - (MBeanUtils.getDomain(ctx) + ":type=WebappClassLoader,context=" - + contextName + ",host=" + ctx.getParent().getName()); + ObjectName cloname = new ObjectName( + MBeanUtils.getDomain(container) + + ":type=WebappClassLoader,context=" + contextName + + ",host=" + container.getParent().getName()); Registry.getRegistry(null, null).unregisterComponent(cloname); } catch (Exception e) { log.error("LifecycleException ", e); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org