Direct calls instead of introspection via JMX
authorcostin <costin@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 20 Jun 2006 20:43:37 +0000 (20:43 +0000)
committercostin <costin@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 20 Jun 2006 20:43:37 +0000 (20:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@415794 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/StandardContext.java

index 400273b..b71fa12 100644 (file)
@@ -4056,6 +4056,7 @@ public class StandardContext
 \r
         // Look for a realm - that may have been configured earlier. \r
         // If the realm is added after context - it'll set itself.\r
+        // TODO: what is the use case for this ? \r
         if( realm == null && mserver != null ) {\r
             ObjectName realmName=null;\r
             try {\r
@@ -4546,7 +4547,7 @@ public class StandardContext
         applicationLifecycleListenersObjects = new Object[0];\r
         \r
         if(log.isDebugEnabled())\r
-            log.debug("resetContext " + oname + " " + mserver);\r
+            log.debug("resetContext " + oname);\r
     }\r
 \r
     /**\r
@@ -5183,20 +5184,18 @@ public class StandardContext
                 host.setAutoDeploy(false);\r
                 Registry.getRegistry(null, null)\r
                     .registerComponent(host, parentName, null);\r
-                mserver.invoke(parentName, "init", new Object[] {}, new String[] {} );\r
+                // We could do it the hard way...\r
+                //mserver.invoke(parentName, "init", new Object[] {}, new String[] {} );\r
+                // or same thing easier:\r
+                host.init();\r
             }\r
             \r
             // Add the main configuration listener\r
             LifecycleListener config = null;\r
             try {\r
-                Object configClassname = null;\r
-                try {\r
-                    configClassname = mserver.getAttribute(parentName, "configClass");\r
-                } catch (AttributeNotFoundException e) {\r
-                    // Ignore, it's normal a host may not have this optional attribute\r
-                }\r
-                if (configClassname != null) {\r
-                    Class clazz = Class.forName(String.valueOf(configClassname));\r
+                String configClassName = ((Host)getParent()).getConfigClass();\r
+                if (configClassName != null) {\r
+                    Class clazz = Class.forName(configClassName);\r
                     config = (LifecycleListener) clazz.newInstance();\r
                 } else {\r
                     config = new ContextConfig();\r
@@ -5211,8 +5210,7 @@ public class StandardContext
                 log.debug("AddChild " + parentName + " " + this);\r
             }\r
             try {\r
-                mserver.invoke(parentName, "addChild", new Object[] { this },\r
-                               new String[] {"org.apache.catalina.Container"});\r
+                ((Host)getParent()).addChild(this);\r
             } catch (Exception e) {\r
                 destroy();\r
                 throw e;\r