Larger application (spring/hibernate/ehcache) running on Terracotta
Published by peter June 15th, 2007 in java.With some tweaking I managed to get one of the webapps in our current project to run using terracotta to cluster caches. The only modification I had to make was related to one of my objects not being threadsafe; actually I solved a potential concurrency problem.
Configuring Terracotta proved to be a bit more complex then I anticipated; but this might be due to my lack of Terracotta knowledge.
Here is the tc-config file I created:
XML:
-
<?xml version="1.0" encoding="UTF-8"?>
-
<tc:tc-config xmlns:tc="http://www.terracotta.org/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-3.xsd">
-
<servers>
-
<server host="%i" name="sample" />
-
</servers>
-
<clients>
-
<logs>/Users/peter/JavaApplications/sandbox/log/%D</logs>
-
<modules>
-
<module name="clustered-commons-collections-3.1" version="1.0.0" />
-
<module name="clustered-ehcache-1.3" version="1.0.0" />
-
<module name="clustered-hibernate-3.1.2" version="1.0.0" />
-
<module name="autolock-synchronizedcollection" version="1.0.0" />
-
<module name="autolock-synchronizedset" version="1.0.0" />
-
</modules>
-
</clients>
-
<application>
-
<spring>
-
<jee-application name="*">
-
<session-support>false</session-support>
-
<instrumented-classes>
-
<include>
-
<class-expression>nl.cinema..*</class-expression>
-
</include>
-
<include>
-
<class-expression>org.hibernate.collection..*</class-expression>
-
</include>
-
<include>
-
<class-expression>org.hibernate.cache..*</class-expression>
-
</include>
-
<include>
-
<class-expression>org.hibernate.type..*</class-expression>
-
</include>
-
<include>
-
<class-expression>org.hibernate.EntityMode</class-expression>
-
</include>
-
</instrumented-classes>
-
<transient-fields>
-
<field-name>net.sf.ehcache.store.DiskStore.spoolThread</field-name>
-
<field-name>net.sf.ehcache.Cache.shutdownHook</field-name>
-
<field-name>net.sf.ehcache.store.LfuMemoryStore.random</field-name>
-
</transient-fields>
-
<locks>
-
<autolock>
-
<method-expression>* nl.cinema.domain.global.Describer.*(..)</method-expression>
-
<lock-level>write</lock-level>
-
</autolock>
-
<autolock>
-
<method-expression>* nl.cinema.domain.util.CacheGroup.*(..)</method-expression>
-
<lock-level>write</lock-level>
-
</autolock>
-
</locks>
-
<application-contexts>
-
<application-context>
-
<paths>
-
<path>/WEB-INF/applicationContext.xml</path>
-
</paths>
-
<beans>
-
<bean name="pageCache">
-
<non-distributed-field>logger</non-distributed-field>
-
<non-distributed-field>configLocation</non-distributed-field>
-
</bean>
-
<bean name="groupCache">
-
<non-distributed-field>logger</non-distributed-field>
-
<non-distributed-field>configLocation</non-distributed-field>
-
</bean>
-
</beans>
-
</application-context>
-
</application-contexts>
-
</jee-application>
-
</spring>
-
</application>
-
</tc:tc-config>
I'm not sure if it would be possible to specify the non-distributed-field in a more global way; without resolving to XML entities.




















0 Responses to “Larger application (spring/hibernate/ehcache) running on Terracotta”
Please Wait
Leave a Reply