/** * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.cache.invalidation.triggers; import org.jboss.ejb.EntityEnterpriseContext; import org.jboss.metadata.EntityMetaData; import org.jboss.invocation.Invocation; /** * This interceptor is similar to the * EntityBeanCacheBatchInvalidatorInterceptor except that it will send out * more cache invalidation messages. * * It is meant to be used in the scenario where a CMP bean is dual-deployed * with an RW and an RO deployment. * * If this CMP bean has extra persistent state that is not handled by the CMP * engine the storage of that data can be ensured by setting * call-ejb-store-on-clean=true in the container configuration. * * But even if call-ejb-store-on-clean=true in the container configuration * a cache invalidation message will not be sent if only non-CMP-managed * persistent state is changed. * * This problem is solved by using this interceptor in place of * EntityBeanCacheBatchInvalidatorInterceptor. * * @author Ole Husgaard */ public class EntityBeanCacheBatchEagerInvalidatorInterceptor extends EntityBeanCacheBatchInvalidatorInterceptor { protected boolean changed(Invocation mi, EntityEnterpriseContext ctx) throws Exception { if (ctx.getId() == null) return true; if (!container.isReadOnly()) { java.lang.reflect.Method method = mi.getMethod(); if (method == null || !container.getBeanMetaData().isMethodReadOnly(method.getName())) return true; } return false; } }