The document discusses using various technologies like Ehcache, Hibernate, and Terracotta for distributed caching and clustering. It provides code samples and configuration for using Ehcache as a second-level cache for Hibernate, and using Terracotta to cluster the Ehcache for distributed caching across multiple servers.
45. CensusCollectServlet.java ... Person person = null; Element element = peopleCache.get(ssn); if (person == null) { person = new Person(); } else { person = (Person)element.getValue(); } request.setAttribute(PERSON, person); ... peopleCache.put(new Element(ssn, person)); ...
51. Terracotta Server $ terracotta-3.2.0/bin/start-tc-server.sh Start the Terracotta Server First The Terracotta server must be started before any applications that use Terracotta.
67. Terracotta Server $ /opt/terracotta-3.2.0/bin/start-tc-server.sh Start the Terracotta Server First The Terracotta server must be started before any applications that use Terracotta.
68. Hibernate Application $ export JAVA_OPTS="-javaagent:/opt/terracotta-3.2.0/hibernate/terracotta-hibernate-agent-1.1.0.jar" $ /opt/apache-tomcat-6.0.24/bin/startup.sh Start Application with Options The application must be started with special JAVA_OPTS set for Terracotta.