3 Replies Latest reply on Sep 6, 2004 2:43 PM by Pedro Salazar

    RW/RO cache invalidation

    Dave Head-Rapson Newbie


      Hi,

      I'm having trouble implementing the RO/RW pattern for EJBs in the same JVM, as described in the Clustering documentation.

      I have 2 EJBs, one deployed read-write (VendorEJB) and one deployed read-only (VendorEJBReadOnly). What i require is that on updating the RW EJB, the cache for the other RO EJB should be invalidated.

      Both ejbs deply correctly, and the InvalidationGroup MBean is displayed in the JMX console, but currently when I update the RW EJB, the RO EJB cache doesn't invalidate.

      Can anyone spot an obvious error in the descriptors ? Does anyone know if the value in the <transaction-attribute> could affect this ? I currently have the 'Required' for the RW EJBs and NotSupported for the RO EJBs.

      I'm using the brand new 3.2.2 production version & I've included the code below. Any help anyone can offer would be greatly appreciated.

      My ejb-jar.xml includes
      <ejb-jar>

      <ejb-name>VendorEJB</ejb-name>
      <local-home>com.communix.catalog.ejb.vendor.VendorLocalHome</local-home>
      com.communix.catalog.ejb.vendor.VendorLocal
      <ejb-class>com.communix.catalog.ejb.vendor.VendorEJB</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>VendorSchema</abstract-schema-name>
      <cmp-field>
      <field-name>id</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>visible</field-name>
      </cmp-field>
      <primkey-field>id</primkey-field>


      <ejb-name>VendorEJBReadOnly</ejb-name>
      <local-home>com.communix.catalog.ejb.vendor.VendorLocalHome</local-home>
      com.communix.catalog.ejb.vendor.VendorLocal
      <ejb-class>com.communix.catalog.ejb.vendor.VendorEJB</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>VendorSchemaReadOnly</abstract-schema-name>
      <cmp-field>
      <field-name>id</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>visible</field-name>
      </cmp-field>
      <primkey-field>id</primkey-field>

      </ejb-jar>

      My jboss.xml reads:


      <enterprise-beans>

      <ejb-name>VendorEJB</ejb-name>
      <local-jndi-name>ejb/catalog/Vendor</local-jndi-name>
      <read-only>false</read-only>
      <configuration-name>VendorEJB Container Configuration</configuration-name>
      <cache-invalidation>True</cache-invalidation>
      <cache-invalidation-config> <invalidation-group-name>VendorEJBGroup</invalidation-group-name>

      </cache-invalidation-config>


      <ejb-name>VendorEJBReadOnly</ejb-name>
      <local-jndi-name>ejb/catalog/VendorReadOnly</local-jndi-name>
      <read-only>true</read-only>
      <configuration-name>VendorEJBReadOnly Container Configuration</configuration-name>
      <cache-invalidation>True</cache-invalidation>
      <cache-invalidation-config>
      <invalidation-group-name>VendorEJBGroup</invalidation-group-name>

      </cache-invalidation-config>

      </enterprise-beans>
      <container-configurations>
      <container-configuration extends="Standard CMP 2.x EntityBean">
      <container-name>VendorEJB Container Configuration</container-name>
      <commit-option>C</commit-option>
      </container-configuration>
      <container-configuration extends="Standard CMP 2.x EntityBean">
      <container-name>VendorEJBReadOnly Container Configuration</container-name>
      <commit-option>A</commit-option>
      </container-configuration>
      </container-configurations>



      My jbosscmp-jdbc.xml reads:


      <jbosscmp-jdbc>

      <ejb-name>VendorEJB</ejb-name>
      java:/datasource-localpetstorePool
      <datasource-mapping>Oracle9i</datasource-mapping>
      <table-name>VENDOR</table-name>
      <cmp-field>
      <field-name>id</field-name>
      <column-name>VENDORID</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>visible</field-name>
      <column-name>VISIBLE</column-name>
      </cmp-field>


      <ejb-name>VendorEJBReadOnly</ejb-name>
      java:/datasource-localpetstorePool
      <datasource-mapping>Oracle9i</datasource-mapping>
      <table-name>VENDOR</table-name>
      <cmp-field>
      <field-name>id</field-name>
      <column-name>VENDORID</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>visible</field-name>
      <column-name>VISIBLE</column-name>
      </cmp-field>

      </jbosscmp-jdbc>

      Thanks in advance
      Dave