Restore the naming resource MBeans
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 25 May 2010 22:43:45 +0000 (22:43 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 25 May 2010 22:43:45 +0000 (22:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@948232 13f79535-47bb-0310-9956-ffa450edef68

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

index e77f0ba..9b393d8 100644 (file)
@@ -418,7 +418,7 @@ public class StandardContext extends ContainerBase
      * The naming resources for this web application.
      */
     private NamingResources namingResources = null;
-
+    private ObjectName onameNamingResoucres;
 
     /**
      * The message destinations for this web application.
@@ -1745,7 +1745,10 @@ public class StandardContext extends ContainerBase
         namingResources.setContainer(this);
         support.firePropertyChange("namingResources",
                                    oldNamingResources, this.namingResources);
-
+        
+        unregister(onameNamingResoucres);
+        onameNamingResoucres = register(namingResources,
+                "type=NamingResources," + getObjectNameKeyProperties());
     }
 
 
@@ -4992,6 +4995,8 @@ public class StandardContext extends ContainerBase
                             sequenceNumber++);
         broadcaster.sendNotification(notification);
 
+        unregister(onameNamingResoucres);
+
         synchronized (instanceListenersLock) {
             instanceListeners = new String[0];
         }
@@ -5542,6 +5547,12 @@ public class StandardContext extends ContainerBase
             this.addLifecycleListener(new TldConfig());
         }
 
+        // Register the naming resources
+        if (namingResources != null) {
+            onameNamingResoucres = register(namingResources,
+                    "type=NamingResources," + getObjectNameKeyProperties());
+        }
+
         // Send j2ee.object.created notification 
         if (this.getObjectName() != null) {
             Notification notification = new Notification(
index c298277..d715b7f 100644 (file)
@@ -692,6 +692,10 @@ public final class StandardServer extends LifecycleMBeanBase
         // Register the MBeanFactory
         onameMBeanFactory = register(new MBeanFactory(), "type=MBeanFactory");
         
+        // Register the naming resources
+        onameNamingResoucres = register(globalNamingResources,
+                "type=NamingResources");
+        
         // Initialize our defined Services
         for (int i = 0; i < services.length; i++) {
             services[i].init();
@@ -709,11 +713,14 @@ public final class StandardServer extends LifecycleMBeanBase
         
         unregister(onameStringCache);
         
+        unregister(onameNamingResoucres);
+        
         super.destroyInternal();
     }
 
     private ObjectName onameStringCache;
     private ObjectName onameMBeanFactory;
+    private ObjectName onameNamingResoucres;
     
     /**
      * Obtain the MBean domain for this server. The domain is obtained using