incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1230163 - /sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java
Date Wed, 11 Jan 2012 17:31:28 GMT
Author: justin
Date: Wed Jan 11 17:31:28 2012
New Revision: 1230163

URL: http://svn.apache.org/viewvc?rev=1230163&view=rev
Log:
SLING-2357 - unregistering mbean service in deactivate()

Modified:
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java?rev=1230163&r1=1230162&r2=1230163&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java
(original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java
Wed Jan 11 17:31:28 2012
@@ -180,6 +180,8 @@ public class SlingMainServlet extends Ge
 
     private ServiceRegistration requestProcessorRegistration;
 
+    private ServiceRegistration requestProcessorMBeanRegistration;
+
     // ---------- Servlet API -------------------------------------------------
 
     public void service(ServletRequest req, ServletResponse res)
@@ -438,7 +440,7 @@ public class SlingMainServlet extends Ge
             mbeanProps.put("jmx.objectname", "org.apache.sling:type=engine,service=RequestProcessor");
 
             RequestProcessorMBeanImpl mbean = new RequestProcessorMBeanImpl();
-            bundleContext.registerService(RequestProcessorMBean.class.getName(), mbean, mbeanProps);
+            requestProcessorMBeanRegistration = bundleContext.registerService(RequestProcessorMBean.class.getName(),
mbean, mbeanProps);
             requestProcessor.setMBean(mbean);
         } catch (Throwable t) {
             log.debug("Unable to register mbean");
@@ -465,6 +467,11 @@ public class SlingMainServlet extends Ge
             requestProcessorRegistration = null;
         }
 
+        if (requestProcessorMBeanRegistration != null) {
+            requestProcessorMBeanRegistration.unregister();
+            requestProcessorMBeanRegistration = null;
+        }
+
         // unregister request recorder plugin
         try {
             RequestHistoryConsolePlugin.destroyPlugin();



Mime
View raw message