Thomas Enebo Releases JMX Gem
jruby -S gem install jmx
Once you have it you can do things like:
server = JMX.simple_server
client = JMX.connect
memory = client["java.lang:type=Memory"]
Or even construct your own MBean from within Ruby code:
class MyDynamicMBean < RubyDynamicMBean[see jmx/test/jmx_server_test.rb for details on how to register]
operation "Doubles a value"
parameter :int, "a", "Value to double"
a + a
This library is still a little rough around the edges, but I have used it to great utility for debugging permgen memory issues. Charlie also recently just committed some MBeans for monitoring the JIT statistics (along with a way to flush the JIT cache). This client should be helpful for us to write some nice Ruby-friendly scripts to analyze a running instance.
Have fun and if you have questions come onto our IRC channel (#jruby at irc.freenode.net) or send an email to one of our mailing lists.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)