Recently I've seen several people ask what the cost of enabling
JMX monitoring on an application is. If I run with
-Dcom.sun.management.jmxremote and connect
jconsole, how much will that affect the performance of my app?
Here are the results of some highly unscientific
experiments.
Here's the quick answer for people who look at the answers in
the back of...
I often want to test that my MBeans work correctly when accessed remotely. For example it's easy to accidentally introduce non-serializable objects in them. It's a pain to set up a real remote connection, but you can make a loopback connection in the same JVM to test most of the same things. Here's how.
import javax.management.*;
import javax.management.remote.*;
...
MBeanServer mbs = ......
MBean proxies allow you to access an MBean through a Java
interface, writing proxy.getFoo() instead of
mbeanServer.getAttribute(name, "Foo"). But when you create a
proxy, there is no check that the MBean actually matches the
interface you specify, or even that the MBean exists. Why is
that, and what can you do about it?
Here's a more concrete example. Suppose...