With a Standard MBean, you define the management interface of the MBean using a Java interface. Getters and setters in the interface define attributes, and other methods define operations. But the only information extracted out of the interface is the names and types of the attributes and operations, and just the types of the operation parameters. Although the JMX API allows for textual descriptions to be associated with attributes, operations, and parameters, when you use a Standard MBean these descriptions have meaningless default values. Parameters also have default names like p1, p2, etc. Here's how you can use subclassing and annotations to overcome these limitations.
Yesterday I mentioned some ways in which you can clean up after resources which are no longer referenced. Here is a way to combine WeakReferences and Dynamic Proxies to reduce the amount of application-specific code you need to write.
A frequent way of using MBeans is to connect an MBean to another Java object that represents the resource being managed. When that resource goes away, we want the MBean to go away too. One way to achieve that is to create a "weak" MBean that detects when the resource is no longer referenced. That's not necessarily the best way.
Occasionally you might have to deal with more than one version of the same class, and with different serial forms for each version. This is tricky, but possible. Here are some tips.
The short answer is: you can, but you probably shouldn't. Here's why.
I'm back from JavaOne, which was great. One of the reasons it was great was that I got a huge amount of feedback about what people would like to see in future versions of the JMX API.
This article by D J Walker-Morgan covers how to use JConsole to see VM information, and especially how to write an MBean and attach JConsole to check it out.
Sun has recently submitted the Java Module System JSR to revise the Java packaging architecture, and I am very exciting to announce that the JCP has begun voting on this JSR!
We've posted a detailed set of guidelines for using the JMX API, the result of several years' experience with it. Feedback is welcome!
Get the skinny on what lies underneath Matisse: NetBeans new forms builder
I'm the Specification Lead for Java Management Extensions (JMX) technology and I expect to be talking about it quite a bit in this blog.
Sun has released a new license today for JDK 5.0 called the Java Internal Use License (JIUL). This license lets developers easily make changes to the JDK for internal deployments. It's free, click-through and easy-to-read by non-lawyers.
When I was given the assignment of converting the old JDK 1.4.2 HPROF agent library from the experimental JVMPI to the new "JVM TI" in JDK 5.0, it was with the understanding that this new HPROF profiler needed to do bytecode instrumentation (or sometimes called "bytecode injection" or "bytecode insertion") to capture method entry, method exit, object allocation, and object free events.
The JDK Community is launched to meet the needs of collaborative J2SE development.