You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by David Potter <dp...@infocomp.com> on 2007/03/21 05:35:55 UTC

Problem with ManagementContext.shutdown()

While I have been looking at the mBean "problem" with WebSphere I think that
I have found a bug in
org.apache.servicemix.jbi.management.ManagementContext.shutDown() (in
Servicemix-core).

The problem code is:
        Object[] beans = beanMap.keySet().toArray();
        for (int i = 0; i < beans.length; i++) {
            try {
                unregisterMBean(beans[i]);
            } catch (Exception e) {
                log.debug("Could not unregister mbean", e);
            }
        }

The object[] will contain the keys - these is an array of ObjectName but
they are typed as Object

There are two unregisterMBean methods unregisterMBean(Object bean) and
unregisterMBean(ObjectName name).

The code will now call unregisterMBean(Object bean) when we want it to call
unregisterMBean(ObjectName name). this will result in no beans being
unregisters from this method.

The fix is, I think, to cast bean[i] to an ObjectName in the method call.

David


-- 
View this message in context: http://www.nabble.com/Problem-with-ManagementContext.shutdown%28%29-tf3438328s12049.html#a9587215
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Problem with ManagementContext.shutdown()

Posted by David Potter <dp...@infocomp.com>.
Jira raised - SM-892

I am happy to work on a fix for this.

David



gnodet wrote:
> 
> Good catch !
> Could you please raise a JIRA ?
> 
> On 3/21/07, David Potter <dp...@infocomp.com> wrote:
>>
>>
>> While I have been looking at the mBean "problem" with WebSphere I think
>> that
>> I have found a bug in
>> org.apache.servicemix.jbi.management.ManagementContext.shutDown() (in
>> Servicemix-core).
>>
>> The problem code is:
>>         Object[] beans = beanMap.keySet().toArray();
>>         for (int i = 0; i < beans.length; i++) {
>>             try {
>>                 unregisterMBean(beans[i]);
>>             } catch (Exception e) {
>>                 log.debug("Could not unregister mbean", e);
>>             }
>>         }
>>
>> The object[] will contain the keys - these is an array of ObjectName but
>> they are typed as Object
>>
>> There are two unregisterMBean methods unregisterMBean(Object bean) and
>> unregisterMBean(ObjectName name).
>>
>> The code will now call unregisterMBean(Object bean) when we want it to
>> call
>> unregisterMBean(ObjectName name). this will result in no beans being
>> unregisters from this method.
>>
>> The fix is, I think, to cast bean[i] to an ObjectName in the method call.
>>
>> David
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Problem-with-ManagementContext.shutdown%28%29-tf3438328s12049.html#a9587215
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Architect, LogicBlaze (http://www.logicblaze.com/)
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-ManagementContext.shutdown%28%29-tf3438328s12049.html#a9604667
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Problem with ManagementContext.shutdown()

Posted by Guillaume Nodet <gn...@gmail.com>.
Good catch !
Could you please raise a JIRA ?

On 3/21/07, David Potter <dp...@infocomp.com> wrote:
>
>
> While I have been looking at the mBean "problem" with WebSphere I think
> that
> I have found a bug in
> org.apache.servicemix.jbi.management.ManagementContext.shutDown() (in
> Servicemix-core).
>
> The problem code is:
>         Object[] beans = beanMap.keySet().toArray();
>         for (int i = 0; i < beans.length; i++) {
>             try {
>                 unregisterMBean(beans[i]);
>             } catch (Exception e) {
>                 log.debug("Could not unregister mbean", e);
>             }
>         }
>
> The object[] will contain the keys - these is an array of ObjectName but
> they are typed as Object
>
> There are two unregisterMBean methods unregisterMBean(Object bean) and
> unregisterMBean(ObjectName name).
>
> The code will now call unregisterMBean(Object bean) when we want it to
> call
> unregisterMBean(ObjectName name). this will result in no beans being
> unregisters from this method.
>
> The fix is, I think, to cast bean[i] to an ObjectName in the method call.
>
> David
>
>
> --
> View this message in context:
> http://www.nabble.com/Problem-with-ManagementContext.shutdown%28%29-tf3438328s12049.html#a9587215
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Architect, LogicBlaze (http://www.logicblaze.com/)
Blog: http://gnodet.blogspot.com/