Terracotta Framework Library > Samples > Clustered Classloader

Cluster Classloader - Demo for the Terracotta Clustered Classloader

About

This sample is a part of the Terracotta Framework Library - tclib. More information is available from the Terracotta Framework Library readme.html.

This application implements a clustered classloader sample. More information on the creation of this sample can be found on Taylor Gautier's Technical Java Blog java.think():

Build Instructions

This sample application requires Maven 2 and Java 5. First download and install Maven 2. Then perform these steps:

  1. Step up into the parent tclib directory cd ..
  2. Invoke mvn install to install the tclib library
  3. Step back into the clusterclassloader sample directory
  4. Invoke mvn package to build the sample1 and sample2 application.

Run Instructions

To demonstrate the clusterclassloader, two projects are required, so that isolation of the classloader hierarchy from one project to the next is clearly demonstrated.

  1. CD to the Sample1 application directory

    $ cd sample1

  2. Start a TC Server:

    $ mvn tc:start

  3. Start Sample1:

    $ mvn tc:run

    [INFO] [node] Putting one work item...
    [INFO] Finished node node
    [INFO] DSO processes finished
    [INFO] Skipping stopping DSO Server
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 26 seconds
    [INFO] Finished at: Sun Jun 22 12:56:21 PDT 2008
    [INFO] Final Memory: 14M/29M
    [INFO] ------------------------------------------------------------------------
    

  4. CD to the Sample2 application directory

    $ cd ../sample2

  5. Start Sample2:

    $ mvn tc:run

    [INFO] [node] Waiting for work...(press Ctrl-C to stop)
    [INFO] [node] This is Callable2 calling!
    [INFO] [node] Waiting for work...(press Ctrl-C to stop)
    ^CDestroying 1 processes
    Destroyed 1 processes
    [INFO] Finished node node
    [INFO] DSO processes finished
    [INFO] Skipping stopping DSO Server
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 27 seconds
    [INFO] Finished at: Sun Jun 22 12:58:59 PDT 2008