<howto>
h1.  Instrumentation Recipe

h2.  Summary

To be portable, Terracotta requires that classes are instrumented.  This example builds on the Hello World example, by refactoring the {{int counter}} field of the Hello World example into its own class.  

In this example, because {{Counter.java}} is a custom class that will be shared in Terracotta, we must indicate to Terracotta that it must be instrumented.

Notice in the tc-config.xml file we have added an {{instrumented-classes}} section, with a reference to the {{Counter}} class, which tells Terracotta to instrument the {{Counter}} class.

h2.  How to run
(Note: A Terracotta Server instance is always required to run Terracotta.  dso-java(.sh|.bat) is a wrapper script that adds Terracotta to standard java)

*Node 1:*
{code}
$ javac *.java
$ start-tc-server &amp;
$ dso-java Main
count is 1
{code}

*Node 2:*
{code}
$ dso-java Main
count is 2
{code}
</howto>
