tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: [OT] Self-describing JMX Beans
Date Wed, 12 Jun 2019 13:36:00 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

ping

> All,
> 
> I'm starting to wire some application-specific JMX Beans into my 
> application and I'm struggling to make them self-describing.
> Meaning, I'd like for a JMX client such as jconsole to show my
> customized descriptions for the bean, the attributes, etc.
> 
> At first, I had a simple interface like:
> 
> public interface MyMBean { public int getSomeValue(); }
> 
> And an implementation:
> 
> public class MyMBeanImpl implements MyMbean { public int
> getSomeValue() { return ...; } }
> 
> Doing a bit of reading, it looked like I needed to implement 
> ModelMBeanInfo in order to be able to return the various Info
> objects to describe the MBean.
> 
> So I did the simplest thing I could possibly do: I extended 
> ModelMBeanInfoSupport:
> 
> public class MyMBeanImpl extends ModelMBeanInfoSupport implements
> MyMbean { public MeMBeanImpl() { super("name", "description",
> createMBeanAttributeInfos(), null, null, null); } public int
> getSomeValue() { return ...; }
> 
> static MBeanAttributeInfo[] createMBeanAttributeInfos() { return
> new MBeanAttributeInfo[] { new MBeanAttributeInfo("SomeValue",
> "description", "int", true, false, false); }; } }
> 
> When I do this, there does not seem to be any change in the
> display from VisualVM for this bean. The "SomeValue" attribute is
> still showing with a description of "SomeValue" and not my custom
> description.
> 
> When registering the MBean with the server, I just do this:
> 
> MBeanServerFactory.findMBeanServer(null)[0].registerMBean(new 
> MyBean(), new ObjectName("path-to-my-object"));
> 
> What am I missing, here?
> 
> Thanks, -chris
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl0A/8AACgkQHPApP6U8
pFjLBg//aLp4HHJkdknpQY658FYkPFm5v6Hd5o72ifX9QsXRAvO1hA0PI8n2SYJM
vYd5uoMaAuUi1/p9bYegTJgmbWaYNSKfWCVvLXk3nx/CN7rKMs1Qjzhcv8Ma4qXH
iCEzDF6qgb1wdnWfvN+Dgdg6RI21jm7ysaoom0hnndXEilH9RXGjN/1h5zFXmV1K
RQI4NtMbiUu4c6t9peD12vfs7dSVq3MiqdNSivyuQY0xC+cU0uNQYKr8kZAQyWvh
S2ihUKbJ4snlHgL6YSbXuD+m5PBHS3BLhsJhAvvuVApDq6JBHjctjC0HmLoEIrgo
Zq7euNhn7PUikAl3acpnJXC8WKxH/GZzB4nFdqSx5YJveug8kB8LR8ySp3zItbTt
cdcoSJAM+pqoEGDCX6wfJvUK/LS8o7560aMylgNIRBx+iCntIsvjU7x/SaBwwivt
3XBcBnE0Uei0sRNOUzY1riMCsJVWPhZfBudVe1zewUJMHYCbOZVXlo6hE2h3nsOX
OiQjW0Wom73mdvwlGyfhCFG+g4C5BTrJyIe+Ncr9Aau+BluMYAZ6f+uP9Az7FN/Z
Ae6f4zfu1izApERDhSIcTf9mS55H8yxNBpepiEJrogekg/fV7vhIpxlfnFynhj1w
g1a2uufGHkZnlr8Eh+xO57t1HHHYs2/l6xoWddMLHIXP7v4LaHM=
=e85a
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message