Since what you require is really system specific, it would have to been done via native method calls (meaning having to write C++ or some other native language). You could then take this native code and access it via Java (JNI) and wrap it in an MBean. To my knowledge, this is the only way to go.
Since this is a fairly common requirement, so you might find a project on SourceForge that already provides the code you need. If you find something like this, please post it badk to the forum for others.
This might be included in java 1.5
There are plans to monitor the jvm using jmx.
I think I first have to remind you that
JMX is just a standard for any management client applicaiton that follows this API can find and get/set/invoke an MBean (agent or the target object itself). So, if you can do anything in JAVA or even JNI,
then you can do it using JMX.
Whether you can do or not is totally dependent on if you can do the job when JMX is not involved.
Specifically, you can get free JVM memory through Runtime.getmemeory and you can shutdown using some system dependent JNI code.
we've developed a runtime stats mbean that will allow you to explore/send notifications about:
- CPU load
- RAM in usage
- Handle count
- Free/Available Disk Space
Requires JNI to get the values, and works on Windows and Linux currently.
I'd like to open source it and get it into JBoss distro soon... when i have some more time.
Somebody has another solution for this question?
Thanks in advance
java.lang.management.ThreadMXBean in jdk5