Java Reference
In-Depth Information
application, you first download the distribution. The distribution provides utility scripts, as well as jars.
You may download Terracotta from .
For Terracotta to work, you need to provide it with a configuration file. This file is an XML file that
we'll review shortly. You start Terracotta as follows:
For all virtual machine clients that you want to “see” and share that state, start it with a customized
bootclasspath parameter when starting java. The arguments for this vary per operating system, so
Terracotta provides a handy script for determining the correct arguments, . When provided
with the host and port of the Terracotta server, it can ensure that all configuration data for each client
virtual machine is loaded dynamically from the server. As you might imagine, this greatly eases
deployment over a grid of any substantive size! Here's how to use the script:
Replace $TERRACOTTA_HOME with the Terracotta's installation directory, and replace $HOST and $PORT
with the host and port of the server instance. When run, it will print out the correct arguments, which
you then need to feed into each client virtual machine's invocation scripts, for example in the
$JAVA_OPTS section for Tomcat or any standard java invocation.
$ localhost:9510
When executed, this will produce something like the following, which you need to ensure is used in
your invocation of the java command:
hotspot_win32_160_14-ea.jar -Dtc.install-root=c:\dev\terracotta-3.0.0
How to Build a Terracotta XML Configuration File
The XML for the Terracotta configuration is verbose but self evident. Terracotta is a 99% code-incursion-
free solution. Because Terracotta works at such a low level, you don't need to know about it when
programming. The only thing of concern may be the introduction of threading issues, which you would
not have to deal with in strictly serialized execution. There are no annotations, and no APIs, to direct
Terracotta. Instead, Terracotta gets its information from the XML configuration file that you provide it.
Our example XML file ( tc-customerconsole-wo-spring.xml ) is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<tc:tc-config xmlns:tc=""
xsi:schemaLocation="" >
<server host="%i" name="server1">
Search WWH ::

Custom Search