Add the new contextName property of WebappClassLoader
authorrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 14 May 2010 18:59:22 +0000 (18:59 +0000)
committerrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 14 May 2010 18:59:22 +0000 (18:59 +0000)
to its toString() and expose a read only via JMX.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@944396 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/loader/WebappClassLoader.java
java/org/apache/catalina/loader/mbeans-descriptors.xml

index 5c1c678..561b2e6 100644 (file)
@@ -469,7 +469,7 @@ public class WebappClassLoader
 
     
     /**
-     * Name of associated context used with logging to associate messages with
+     * Name of associated context used with logging and JMX to associate with
      * the right web application. Particularly useful for the clear references
      * messages. Defaults to unknown but if standard Tomcat components are used
      * it will be updated during initialisation from the resources.
@@ -504,6 +504,16 @@ public class WebappClassLoader
 
 
     /**
+     * Return the context name for this class loader.
+     */
+    public String getContextName() {
+
+        return (this.contextName);
+
+    }
+
+
+    /**
      * Return the "delegate first" flag for this class loader.
      */
     public boolean getDelegate() {
@@ -1008,6 +1018,9 @@ public class WebappClassLoader
     public String toString() {
 
         StringBuilder sb = new StringBuilder("WebappClassLoader\r\n");
+        sb.append("  context: ");
+        sb.append(contextName);
+        sb.append("\r\n");
         sb.append("  delegate: ");
         sb.append(delegate);
         sb.append("\r\n");
index 06fc5ad..834f6a9 100644 (file)
                  type="java.lang.String"
             writeable="false"/>
 
+    <attribute   name="contextName"
+          description="Name of the webapp context"
+                 type="java.lang.String"
+            writeable="false"/>
+
     <attribute   name="delegate"
           description="The 'follow standard delegation model' flag that will be
                        used to configure our ClassLoader"