jmx-dev MBean attribute deprecation

Daniel Fuchs daniel.fuchs at oracle.com
Thu Jul 23 13:36:06 UTC 2020


Hi Milan,

JMX is being maintained by serviceability these days.
I am forwarding your question there.

This is an interesting observation. JMX makes it possible to
define and use annotations on methods/getters/setters, to add
key/value pairs to the Descriptor of the corresponding
MBeanFeatureInfo.

The mechanism should probably be extended so that the standard
@Deprecated annotation is also reflected in the Descriptor.

best regards,

-- daniel

On 23/07/2020 13:25, Milan Mimica wrote:
> Hello list
> 
> With deprecation of OperatingSystem#SystemCpuLoad in favor of 
> OperatingSystem#CpuLoad [1] an issue raised with generic tools that 
> query all MBean attributes. Querying CPU usage is not side-effect-free: 
> the immediate subsequent query for CPU load will often return a skewed 
> value (on Linux at least, haven't checked others)[2]. This results in 
> exported data where either new or deprecated MBean value is wrong and 
> misleading.
> 
> There are many tools and libraries that generically export JMX metrics, 
> so I think this should be addressed somehow. Maybe we could add a 
> property in MBeanAttributeInfo which would mark the attribute as 
> deprecated? These tools could then skip such metrics.
> 
> 
> [1] 
> https://docs.oracle.com/en/java/javase/14/docs/api/jdk.management/com/sun/management/OperatingSystemMXBean.html#getSystemCpuLoad()
> [2] 
> https://medium.com/@milan.mimica/the-java-cpu-usage-observer-effect-18808b18323f
> 
> -- 
> Milan Mimica
> 



More information about the jmx-dev mailing list