aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARIES-1169) NPE and mbean not unregistered
Date Sat, 29 Mar 2014 19:57:14 GMT

    [ https://issues.apache.org/jira/browse/ARIES-1169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13954418#comment-13954418
] 

Guillaume Nodet commented on ARIES-1169:
----------------------------------------

Suggested patch:
{code}
diff --git a/jmx/jmx-core/src/main/java/org/apache/aries/jmx/MBeanServiceTracker.java b/jmx/jmx-core/src/main/java/org/apache/aries/jmx/MBeanServiceTracker.java
index f35e495..679fd29 100644
--- a/jmx/jmx-core/src/main/java/org/apache/aries/jmx/MBeanServiceTracker.java
+++ b/jmx/jmx-core/src/main/java/org/apache/aries/jmx/MBeanServiceTracker.java
@@ -51,7 +51,7 @@ public class MBeanServiceTracker extends ServiceTracker {
      * @see ServiceTracker#addingService(ServiceReference)
      */
     public Object addingService(final ServiceReference reference) {
-        final MBeanServer mbeanServer = (MBeanServer) context.getService(reference);
+        final MBeanServer mbeanServer = (MBeanServer) super.addingService(reference);
         Logger logger = agentContext.getLogger();
         logger.log(LogService.LOG_DEBUG, "Discovered MBean server " + mbeanServer);
         ExecutorService executor = agentContext.getRegistrationExecutor();
@@ -63,7 +63,7 @@ public class MBeanServiceTracker extends ServiceTracker {
             }
         });
 
-        return super.addingService(reference);
+        return mbeanServer;
     }
 
     /**
@@ -73,9 +73,9 @@ public class MBeanServiceTracker extends ServiceTracker {
      * @see ServiceTracker#removedService(ServiceReference, Object)
      */
     public void removedService(final ServiceReference reference, Object service) {
-        final MBeanServer mbeanServer = (MBeanServer) context.getService(reference);
+        final MBeanServer mbeanServer = (MBeanServer) service;
         Logger logger = agentContext.getLogger();
-        logger.log(LogService.LOG_DEBUG, "MBean server " + mbeanServer+ " is unregistered
from SeviceRegistry");
+        logger.log(LogService.LOG_DEBUG, "MBean server " + mbeanServer+ " is unregistered
from ServiceRegistry");
         ExecutorService executor = agentContext.getRegistrationExecutor();
         executor.submit(new Runnable() {
 
@@ -83,6 +83,7 @@ public class MBeanServiceTracker extends ServiceTracker {
                 agentContext.unregisterMBeans(mbeanServer);
             }
         });
+
         super.removedService(reference, service);
     }
 
{code}

> NPE and mbean not unregistered
> ------------------------------
>
>                 Key: ARIES-1169
>                 URL: https://issues.apache.org/jira/browse/ARIES-1169
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>         Environment: jmx-core-1.1.1
>            Reporter: Guillaume Nodet
>
> {code}
> java.lang.NullPointerException
> 	at org.apache.aries.jmx.agent.JMXAgentImpl.unregisterMBeans(JMXAgentImpl.java:165)[14:org.apache.aries.jmx.core:1.1.1]
> 	at org.apache.aries.jmx.agent.JMXAgentContext.unregisterMBeans(JMXAgentContext.java:66)[14:org.apache.aries.jmx.core:1.1.1]
> 	at org.apache.aries.jmx.MBeanServiceTracker$2.run(MBeanServiceTracker.java:83)[14:org.apache.aries.jmx.core:1.1.1]
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_51]
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_51]
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_51]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_51]
> 	at java.lang.Thread.run(Thread.java:744)[:1.7.0_51]
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message