If you don't want to change the entities then something is going to have to poll them. Either your JMXAgent
or the JMX client is going to have to request the beans every so often. There is no way for you to get around this performance hit although since you are calling a bunch of gets, I don't think it's going to be very expensive. Certainly your JMXAgent
would be better than the JMX client polling all of the time. But if the client is polling all of the beans anyway then the cost may be exactly the same.
You would not need to do the polling if the objects could call the agent to say that they have been changed or if they supported some sort of isDirty()
method.
In our systems, we have a metrics system that the various components used. Each of the classes incremented their own metric and it was the metrics that were wired into a persister. You could request the metric values using JMX or persist them to disk or the wire. By using a Metric
type, then there was separation between the entity that was doing the counting and the entities that needed access to all of the metric values.
By going to a registered Metric
object type model, your GUI could then query the MetricRegistrar
for all of the metrics and display them via JMX, HTML, or whatever. So your entities would just do metric.increment()
or metric.set(...)
and the GUI would query the metric whenever it needed the value.
Hope something here helps.