6 Replies Latest reply on Jul 18, 2007 10:56 AM by k-dub

    JMX interceptors without CacheJmxWrapper

      We want to expose some of the interceptors via JMX, but don't want to expose the functionality of CacheJmxWrapper's setters and methods. I've tried quite a few ways of doing this, but I can't figure it out. Is this not possible?

        • 1. Re: JMX interceptors without CacheJmxWrapper

          Oops, I forgot: This is 2.0.0 CR3 on Sun JDK 1.6.0_02 in a stand-alone app compiled to 1.5 target VM. We're trying to use Spring for configuration, rather than programmatic configuration.

          • 2. Re: JMX interceptors without CacheJmxWrapper
            brian.stansberry

            You'd have to write your own class to handle the JMX registration. You can see what CacheJmxWrapper does; you basically need a CacheSPI (to get the interceptors), an MBeanServer, and some algorithm for creating the ObjectNames for the interceptors.

            Is your concern that the CacheJmxWrapperMBean interface has too much? If you post an MBean interface you want, I can look into creating a limited super-interface that you could expose. No promises though.

            Let me know how the Spring configuration goes. The JBC docs discuss using JBoss Microcontainer to build up a Configuration object, but I see no reason Spring wouldn't work just fine. I just haven't had time to do it to include in a doc.

            • 3. Re: JMX interceptors without CacheJmxWrapper

               

              "bstansberry@jboss.com" wrote:
              Is your concern that the CacheJmxWrapperMBean interface has too much? If you post an MBean interface you want, I can look into creating a limited super-interface that you could expose. No promises though.


              Our concern is that people could change the cache configuration and/or running behavior in undesirable ways. A desired interface would be completely read-only with no methods and no setters.

              I'll look into the CacheSPI and see what is involved there, thanks for the tip.

              • 4. Re: JMX interceptors without CacheJmxWrapper

                So, I tried writing a ReadOnlyCacheJmxWrapperMBean with just getters, along with a ReadOnlyCacheJmxWrapper class which subclassed CacheJmxWrapper. I was very surprised to see JMX use the CacheJmxWrapperMBean interface rather than my ReadOnlyCacheJmxWrapperMBean.

                So I basically had to write out all the functionality in ReadOnlyCacheJmxWrapper rather than subclassing CacheJmxWrapper, then everything worked.

                By the way, I didn't get the Spring config working. I couldn't get any interceptors to show up in JConsole. I went with the programmatic MBean registration.

                • 5. Re: JMX interceptors without CacheJmxWrapper
                  brian.stansberry

                   

                  "k-dub" wrote:
                  So, I tried writing a ReadOnlyCacheJmxWrapperMBean with just getters, along with a ReadOnlyCacheJmxWrapper class which subclassed CacheJmxWrapper. I was very surprised to see JMX use the CacheJmxWrapperMBean interface rather than my ReadOnlyCacheJmxWrapperMBean.


                  That seems strange. How did you register the bean in JMX.

                  • 6. Re: JMX interceptors without CacheJmxWrapper

                    Umm, yeah. Ignore my last post, I'm an idiot. :)

                    I forgot

                    implements ReadOnlyCacheJmxWrapperMBean
                    in my subclass, so naturally JMX exposed the CacheJmxWrapperMBean instead. Duh!