You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dermoritz <ta...@hotmail.com> on 2015/03/16 17:30:04 UTC

Names of custom MBeans contain hex-number at the end

I created some custom MBeans (implementing Service). they work as they should
but for some reason their names have some hexadecimal number at the end e.g.
"JmxController (0x32e652b6)". Is there a way to get rid of this number? What
does this number mean - only my custom "Services" have such a number?






--
View this message in context: http://camel.465427.n5.nabble.com/Names-of-custom-MBeans-contain-hex-number-at-the-end-tp5764226.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Names of custom MBeans contain hex-number at the end

Posted by dermoritz <ta...@hotmail.com>.
Thanks,

that was easy. In my case i use Guice and bound my Serviceimplementations as
Singletons - so i am quite sure there is only one.



--
View this message in context: http://camel.465427.n5.nabble.com/Names-of-custom-MBeans-contain-hex-number-at-the-end-tp5764226p5764252.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Names of custom MBeans contain hex-number at the end

Posted by Willem Jiang <wi...@gmail.com>.
The hex-number is the instanceId to avoid the name conflict. 
If you want to get ride of it, you need to make sure the service is a StaticService which means you have only one instance per Camel Context.

You can find the below code in the DefaultManagementNamingStrategy.

public ObjectName getObjectNameForService(CamelContext context, Service service) throws MalformedObjectNameException {
        StringBuilder buffer = new StringBuilder();
        buffer.append(domainName).append(":");
        buffer.append(KEY_CONTEXT + "=").append(getContextId(context)).append(",");
        buffer.append(KEY_TYPE + "=" + TYPE_SERVICE + ",");
        buffer.append(KEY_NAME + "=").append(service.getClass().getSimpleName());
        if (!(service instanceof StaticService)) {
            buffer.append("(").append(ObjectHelper.getIdentityHashCode(service)).append(")");
        }
        return createObjectName(buffer);
    }

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 17, 2015 at 12:31:06 AM, dermoritz (tanteanni@hotmail.com) wrote:
> I created some custom MBeans (implementing Service). they work as they should
> but for some reason their names have some hexadecimal number at the end e.g.
> "JmxController (0x32e652b6)". Is there a way to get rid of this number? What
> does this number mean - only my custom "Services" have such a number?
>  
>  
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Names-of-custom-MBeans-contain-hex-number-at-the-end-tp5764226.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>