Drawing Hands by M.C. Escher (1948)

Jeff Mesnil

Archive for May 23rd, 2007


JMX Scripts with Eclipse Monkey

On May 23rd, 2007 in eclipse, java, jmx (No Comments »)

Continuing the series about “writing JMX scripts in a dynamic language”, after Ruby (part I & II), let’s do that in JavaScript.

Aside of the use of a different scripting language, this example differs completely from the Ruby one by its context of execution: it will be integrated into Eclipse and called directly from its user interface (using Eclipse Monkey as the glue).

The example will:

  1. ask graphically the user for a logging level
  2. update all the JVM’s loggers with this level
  3. display all the loggers of the JVM

in 50 lines of code.

This example is simple but it implies several interesting steps:

There are many use cases where you have to perform theses steps in repetition. It’s tedious to do that in a JMX console (e.g. jconsole or eclipse-jmx) and most of the time, it is not worth writing a Java application.

These use cases beg to be scripted.

(more…)