Caching problem with commit option D
vin Jun 16, 2003 8:33 AMObjective: Create a caching mechanism that would result in an entity bean's finders returning only it's cached data for a specific period of time (2 minutes, for example), even if the contents of the database are modified external to the program. After the caching period has elapsed, the entity bean's data should be refreshed.
Attempted solution: Use of commit option D, along with an optiond-refresh-rate. A major part of the jboss.xml file we used is shown below.
Platform : jboss3.2.0 / tomcat on Win2000
Actual problem: Objective not achieved. When database contents are externally changed (rows deleted / inserted), the finders immediately return modified number of rows.
Please suggest what changes need to be made, either to the jboss.xml file, or anywhere else.
jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">
<enterprise-beans>
<ejb-name>VinEmailBean</ejb-name>
<local-jndi-name>VinEmailBean</local-jndi-name>
<configuration-name>Standard CMP EntityBean</configuration-name>
<ejb-name>com.waterscape.craftlicencing.business.service.renewalmail.RenewalEmailManager</ejb-name>
<jndi-name>com/waterscape/craftlicencing/business/service/renewalmail/RenewalEmailManager</jndi-name>
</enterprise-beans>
<resource-managers>
</resource-managers>
<container-configurations>
<container-configuration extends="Standard CMP 2.x EntityBean">
<container-name>Standard CMP EntityBean</container-name>
<container-cache-conf>
<cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
<cache-policy-conf>
<min-capacity>4</min-capacity>
<max-capacity>4</max-capacity>
<overager-period>200</overager-period>
<max-bean-age>300</max-bean-age>
<resizer-period>100</resizer-period>
<max-cache-miss-period>120</max-cache-miss-period>
<min-cache-miss-period>90</min-cache-miss-period>
<cache-load-factor>0.5</cache-load-factor>
</cache-policy-conf>
</container-cache-conf>
<commit-option>D</commit-option>
<optiond-refresh-rate>120</optiond-refresh-rate>
</container-configuration>
</container-configurations>