4 Replies Latest reply on Dec 12, 2002 12:38 PM by juha

    caching in model mbean


      Admittedly this is a newbie question. I am reading Juhas great book on jmx. I dont really understand why Id like to cache values in the descriptor of a model mbean, instead of querying the mbean directly. Both calls are in memory (same VM) anyway. Am I missing something ?

        • 1. Re: caching in model mbean

          Well imagine a case where the mbean actually goes over the network to some device to request the value of that attribute. You don't want that to happen everytime some user loads up the HTML adaptor page.

          • 2. Re: caching in model mbean

            thanks Juha, that was a good example. I was all the time thinking in terms of agents and mbeans in the same VM. Obviously from your example, that's not always the case.

            • 3. Re: caching in model mbean

              Thanks Juha. If I understand you correctly this means the agent and the mbean can be in different VMs ?

              • 4. Re: caching in model mbean

                The MBean is in most cases associated with an MBean server. The MBean server can register a proxy in place of the MBean which then delegates the call to another MBean server in a different VM.

                However, in the original example, the idea is that you have an MBean on a JVM somewhere which represents your managed resource, such as a network device. To retrieve or set a value on that device, the MBean uses some network protocol to communicate with the device. In such case you usually would not want to go to the wire every time a HTML adaptor page is requested but cache the value in a Model MBean and retrieve the managed attribute value say once every 30 seconds.

                So the MBean is in the same VM with the server but the actual managed resource is not an in memory object.