4 Replies Latest reply on Jun 20, 2006 8:18 PM by Ben Wang

    JBossCache and PojoCache integrations

    Ben Wang Master

      While reviewing the new PojoCache APIs, couple of integration issues come up with JBossCache. So I am creating a new topic for future issues as well.

      1. Have we thought about how to deploy the new 2.0 MBean service under AS5.0? For example, previously, we simple drop the *-service.xml under "deploy" directory, and viola! The MBean class name and the attributes are both specified in the service.xml file.

      Now, however, we don't expose the attribute setter methods and who is going to implement the JBoss MBean lifecycle methods? Should we create a MBean interface specifically for attribute get/set?

      We need to make sure the way to deploy between JBossCache and PojoCache are consistent.

      2. It will be nice if we split the CacheListener between the Cache (start/stop) and node (modify) instance events. I know this will add 3 additional listener APIs. But from PojoCache perspective, I am only interested in cache instance event (don't want to expose node level events) so I can re-use.

      3. In CacheFactory, we have "createCache" method. How about just "createInstance" since CacheFactory name is itself explicit already. I plan to sub-class the CacheFactory so we have consistent view for the user as well.

        • 1. Re: JBossCache and PojoCache integrations
          Manik Surtani Master

           

          "ben.wang@jboss.com" wrote:

          1. Have we thought about how to deploy the new 2.0 MBean service under AS5.0? For example, previously, we simple drop the *-service.xml under "deploy" directory, and viola! The MBean class name and the attributes are both specified in the service.xml file.

          Now, however, we don't expose the attribute setter methods and who is going to implement the JBoss MBean lifecycle methods? Should we create a MBean interface specifically for attribute get/set?

          We need to make sure the way to deploy between JBossCache and PojoCache are consistent.


          There is a CacheMBean instance that exposes Cache methods (for operations on the cache) as well as lifecycle methods. For configuration, you can retrieve a (read-only) instance of the Configuration.

          For setting the configuration, what would be best, exposing the getters and setters in the CacheMBean interface?

          "ben.wang@jboss.com" wrote:

          2. It will be nice if we split the CacheListener between the Cache (start/stop) and node (modify) instance events. I know this will add 3 additional listener APIs. But from PojoCache perspective, I am only interested in cache instance event (don't want to expose node level events) so I can re-use.


          -1. Not too keen on more listener APIs - Surely the start/stop notifications don't get in your way too much?

          "ben.wang@jboss.com" wrote:

          3. In CacheFactory, we have "createCache" method. How about just "createInstance" since CacheFactory name is itself explicit already. I plan to sub-class the CacheFactory so we have consistent view for the user as well.


          +1


          • 2. Re: JBossCache and PojoCache integrations
            Ben Wang Master

            1. Yeah, I notice from the class diagram you have added the MBean interface. Question then is can we instantiate the cache instance from the MBean, e.g., the lifecycle method is there as well. If yes, then we need to expose attribute getter and setter there for MBean attribute injection.

            Then, PojoCache will have a corresponding MBean interface as well.

            2. Yeah, I can live with that for keeping them in the same listener interface. We may revisit it in the future.

            • 3. Re: JBossCache and PojoCache integrations
              Brian Stansberry Master

              In AS 5.0 the cache will be instantiated via the microcontainer, which has the ability to create objects from a factory:

              I expect the deployment will be a -beans.xml file that is something like:

              <bean name="TomcatClusterCacheFactory" class="org.jboss.cache.PojoCacheFactory"/>
              
              <bean name="TomcatClusterCacheConfig" class="org.jboss.cache.config.Configuration">
               <property name="ClusterName">Tomcat-${jboss.partition.name:Cluster}</property>
               <property name="CacheMode">REPL_ASYNC</property>
               ....
              </bean>
              
              <bean name="TomcatClusterCache" class="org.jboss.cache.PojoCache">
               <constructor factoryMethod="createCache">
               <factory bean="TomcatClusterCacheFactory"/>
               <parameter><inject bean="TomcatClusterCacheConfig"/></parameter>
               </constructor>
              </bean>


              The above example ignores the current discussion of whether to pass a plain cache to the PojoCacheFactory; if we did there would be another level.

              • 4. Re: JBossCache and PojoCache integrations
                Ben Wang Master

                Yeah, I realized it should be bean service after my post.

                But for the standalone (or outside JBoss) mode, we should ship the Configuration bean now (replacing the previous MBean service xml)?

                Or the other option is to place the configuration xml file under the classpath. But this has problem of its own.