Drawing Hands by M.C. Escher (1948)

Jeff Mesnil

Archive for July 4th, 2007


jmx4r 0.0.3, documentation and multiple connections

On July 4th, 2007 in java, jmx, jmx4r, jruby, ruby (1 Comment »)

jmx4r 0.0.3 has just been released.
jmx4r is a JRuby library which makes it super easy to write simple Ruby scripts to manage Java applications using JMX.

Two new features in this release:

  1. some much-needed documentation
  2. as requested by Brian McCallister, I’ve modified the code so that it is now possible to write a script to manage many Java applications at the same time.

For example, the script to trigger a garbage collection on a cluster of Java applications at the same time (quite a bad idea but a simple one):

port = 1090
hosts = ["node1", "node2", "node3", "node4"]
hosts.each do |h|
    memory = JMX::MBean.find_by_name "java.lang:type=Memory", :host => h, :port => port
    memory.gc
end

Quite simple, isn’t it?

(more…)