| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| How to use Castor in a J2EE clusterIntroduction Intended Audience Prerequisites Steps Add <cache-type> element to class mapping Add Coherence JARs to CLASSPATH References IntroductionWith release 0.9.9, several cache providers have been added that are distributed caches per se or can be configured to operate in such a mode. This effectively allows Castor JDO to be used in a clustered J2EE (multi-JVM) environment, where Castor JDO runs on each of the cluster instances, and where cache state is automatically snychronized between these instances. In such an environment, Castor JDO will make use of the underlying cache provider to replicate/distribute the content of a specific cache between the various JDOManager instances. Through the distribution mechanism of the cache provider, a client of a Castor JDO instance on one JVM will see any updates made to domain objects performed against any other JVM/JDO instance. Intended AudienceAnyone who wants to use Castor JDO in a J2EE cluster. The example given describes the use of the Coherence cache provider to enable distributed caching. PrerequisitesYou should have a valid class mapping for a Java class, similar to the following one:
StepsHere is how to proceed. Add <cache-type> element to class mappingAdd a <cache-type> element as shown below, specifying the cache provider to use in the 'type' attribute.
This instructs Castor JDO to use the 'coherence' cache provider for objects of type com.xyz.MyOtherObject. It is the cache provider that is responsible to distribute any changes to the cache state to all other Castor JDO instances within the same cluster. Add Coherence JARs to CLASSPATHAdd the Coherence JARs to the class path of your e.g. web application by putting the JARs into the WEB-INF/lib folder of your web application. References
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||