This looks like it might be useful. I don't know if using JMX for this would make sense or not.