1 Reply Latest reply on Feb 13, 2006 11:28 AM by haseen

    Cache Invalidation - BMP Entity bean is getting invalidated

    haseen

      My application has clustered remote SLSBs with "FirstAvaliable" policy.

      The BMP Entity Beans are set for cache invalidation only as they exist at local level only. They are not set for any clustering.

      I am using Commit Option A.

      I want cache to invalidate bean on all nodes except the node it was accessed from.

      Here the cache is being cleared even on the node it was last accessed from.

      I executed a business method on the same node (due to FirstAvailable) and here is the list of methods encountered.

      setEntityContext
      ejbFindByPrimaryKey
      ejbActivate
      ejbLoad
      getAllAccounts
      ejbStore

      setEntityContext
      ejbActivate
      ejbLoad
      getAllAccounts
      ejbStore

      setEntityContext
      ejbActivate
      ejbLoad
      getAllAccounts
      ejbStore

      My expectation is that second and third time, in addition to my business method, only ejbLoad and ejbStore should be executed.

      After info from guides and forum topics, I have configured as under :

      cluster-service.xml
      ============


      I am using the default behaviour of JBoss-Cluster based bridge


      jboss.cache:service=InvalidationManager
      ${jboss.partition.name:DefaultPartition}
      DefaultJGBridge
      jboss:service=${jboss.partition.name:DefaultPartition}
      jboss.cache:service=InvalidationManager



      standardjboss.xml
      ============


      Container Configuration is defined as under : (Commit Option is A)

      <container-configuration>
      <container-name>Standard BMP 2.x EntityBean with cache invalidation</container-name>
      <call-logging>false</call-logging>
      <invoker-proxy-binding-name>entity-rmi-invoker</invoker-proxy-binding-name>
      <sync-on-commit-only>true</sync-on-commit-only>
      <insert-after-ejb-post-create>false</insert-after-ejb-post-create>
      <container-interceptors>
      org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor
      org.jboss.ejb.plugins.LogInterceptor
      org.jboss.ejb.plugins.SecurityInterceptor
      org.jboss.ejb.plugins.TxInterceptorCMT
      org.jboss.ejb.plugins.EntityCreationInterceptor
      org.jboss.ejb.plugins.EntityLockInterceptor
      org.jboss.ejb.plugins.EntityInstanceInterceptor
      org.jboss.ejb.plugins.EntityReentranceInterceptor
      org.jboss.resource.connectionmanager.CachedConnectionInterceptor
      org.jboss.ejb.plugins.EntitySynchronizationInterceptor

      org.jboss.cache.invalidation.triggers.EntityBeanCacheBatchInvalidatorInterceptor

      org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor

      </container-interceptors>
      <instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>

      <instance-cache>org.jboss.ejb.plugins.InvalidableEntityInstanceCache</instance-cache>


      <persistence-manager>org.jboss.ejb.plugins.BMPPersistenceManager</persistence-manager>
      <locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy>
      <container-cache-conf>
      <cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
      <cache-policy-conf>
      <min-capacity>50</min-capacity>
      <max-capacity>1000000</max-capacity>
      <overager-period>300</overager-period>
      <max-bean-age>600</max-bean-age>
      <resizer-period>400</resizer-period>
      <max-cache-miss-period>60</max-cache-miss-period>
      <min-cache-miss-period>1</min-cache-miss-period>
      <cache-load-factor>0.75</cache-load-factor>
      </cache-policy-conf>
      </container-cache-conf>
      <container-pool-conf>
      100
      </container-pool-conf>
      <commit-option>A</commit-option>
      </container-configuration>



      jboss.xml
      ======


      <?xml version="1.0"?>

      <security-domain>java:/jaas/defaultLdap</security-domain>
      <enterprise-beans>

      <ejb-name>ejb/ApplicationService</ejb-name>
      <security-domain>java:/jaas/defaultLdap</security-domain>
      <resource-ref>
      <res-ref-name>jdbc/OracleDS</res-ref-name>
      <jndi-name>java:/jdbc/OracleDS</jndi-name>
      </resource-ref>
      True
      <cluster-config>
      <home-load-balance-policy>
      org.jboss.ha.framework.interfaces.FirstAvailable
      </home-load-balance-policy>
      <bean-load-balance-policy>
      org.jboss.ha.framework.interfaces.FirstAvailable
      </bean-load-balance-policy>
      </cluster-config>



      <ejb-name>ejb/ApplicationEntity</ejb-name>
      <security-domain>java:/jaas/defaultLdap</security-domain>
      <resource-ref>
      <res-ref-name>jdbc/OracleDS</res-ref-name>
      <jndi-name>java:/jdbc/OracleDS</jndi-name>
      </resource-ref>
      <configuration-name>Standard BMP 2.x EntityBean with cache invalidation</configuration-name>
      <cache-invalidation>True</cache-invalidation>


      ....
      ....


      cache-invalidation.xml (No Change)
      ==============


      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE server>
      <!-- $Id: cache-invalidation-service.xml,v 1.4 2003/08/27 04:31:54 patriot1burke Exp $ -->

      <!-- ===================================================================== -->
      <!-- -->
      <!-- Cache Invalidation Service -->
      <!-- -->
      <!-- ===================================================================== -->







      <!--
      Uncomment if you want to activate the cache invalidation mechanism accross
      nodes using the JMS bridge

      PropagationMode can be : IN_OUT = 1, IN_ONLY = 2, OUT_ONLY = 3

      You can also set the ProviderUrl attribute to another IP:port setting if you
      must lookup your JMS information in other JMS trees i.e.

      MyOtherNode:1099

      -->
      <!--

      <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager
      <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager



      jboss.cache:service=InvalidationManager
      jboss.mq.destination:service=Topic,name=JMSCacheInvalidationBridge
      jboss.cache:service=InvalidationManager
      java:/ConnectionFactory
      topic/JMSCacheInvalidationBridge
      1

      -->




      Thanks.