Fwd: Re: JMX
netbeans at post.cz
netbeans at post.cz
Wed Mar 13 07:32:29 UTC 2019
---------- Původní e-mail ----------
Od: Daniel Fuchs <daniel.fuchs at oracle.com>
Komu: netbeans at post.cz, jdk-dev at openjdk.java.net
Datum: 19. 2. 2019 19:56:19
Předmět: Re: JMX
"Hi,
JMX related issues are mostly discussed on the
serviceability-dev mailing list these days.
On 19/02/2019 09:31, netbeans at post.cz wrote:
>
> Dear Dev.
>
> 1) MXBeans
>
> I would like to recommend you simplify MXBeans as currently it is not so
> easy to use.
>
> E.g. If you need Map<String, Serializable> where even Serializable can be
> simple open types, so like dynamical for dirent key.
MXBeans are used to map model-specific interfaces to generic
openmbeans types. If your model consists of a map with dynamic
key value pairs - as opposed to an interface that has a number
of specific getters - then MXBeans may not be what you should
use.
For instance, you can achieve what you describe by reverting to using
an OpenMBean directly, and expose your map as a CompositeData
instead.
See:
https://docs.oracle.com/en/java/javase/11/docs/api/java.management/javax/
management/package-summary.html
https://docs.oracle.com/en/java/javase/11/docs/api/java.management/javax/
management/MXBean.html
and
https://docs.oracle.com/en/java/javase/11/docs/api/java.management/javax/
management/openmbean/package-summary.html
[...]
> Additionally there is Date, but why it is not there new java.time objects.
JMX was added in Java 5. java.time in Java 8.
Extending the set of open types supported by MXBeans would offer
interesting challenges as to maintaining interoperability with
applications running on previous version of the JVM.
In other words: that might be hard.
> Or maybe MXBeans should be deprecated at all.
MXBeans work very well for their intended target usage.
They do have their limitations, but so have other types of
MBeans. It's a trade-off.
You can read about the different types of MBeans here:
https://docs.oracle.com/en/java/javase/11/docs/api/java.management/javax/
management/package-summary.html
> 2) Maps vs MBean
>
> As you my know there is use e.g. what ever type parameter you choose there
> is get(Object) and similar to other methods.
>
> So if you would like to use it as MBean Proxy you need to create new
> interface extending e.g. Map<String, String> (even target does it) and you
> have to explicitly create get(String).
>
> If you do not do it.
I am not sure I have understood all your concerns, but I believe
OpenMBeans and CompositeData is what might correspond to your needs.
best regards,
-- daniel
"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20190313/da8c593f/attachment.html>
More information about the serviceability-dev
mailing list