How to run the test & demo programs

To run the sample programs you will need the JSpasm demo package Jar file (jspasmdemo-1-0-src.jar) and the core JSpasm package (either the binary-only jspasm-1-0-bin.jar or the combined source/binary jspasm-1-0-src.jar).

The PushButton demo

This the simple program described in the JSpasm Package Description document. To run it, type this at the command prompt:

java -cp jspasm-1-0-bin.jar:jspasmdemo-1-0-src.jar com.codexombie.jspasmdemo.PushButtonDemo
(On Windows systems, use ';' instead of ':' as the classpath separator character).

The program will produce five lines of output and then pause for approximately two seconds before terminating.

The Benchmark program

The benchmark program is designed to provide an estimate of the speed of the JSpasm engine when running on a given platform. To run it:

java -Xmx128m -cp jspasm-1-0-bin.jar:jspasmdemo-1-0-src.jar com.codexombie.jspasmdemo.Benchmark

The program works by generating and delivering two million events, and timing the entire process. The -Xmx128m option on the command line is required to ensure that the JVM has enough memory to hold two million event objects (without it the program may throw an out-of-memory error).

The program usually completes in five to ten seconds on a modern system.

The Test program

The test program was created to test the basic functionality of the JSpasm engine. It uses four intercommunicating state models and over 70,000 entities to perform a large number of mathematical calculations in parallel. To run the program:

java -Djspasm.configuration=com/codexombie/jspasmdemo/ -cp jspasm-1-0-bin.jar:jspasmdemo-1-0-src.jar com.codexombie.jspasmdemo.JSpasmTest

This program produces a large volume of output standard output (19,000 lines of data). It should not report any exception conditions.

Running the programs using different thread schemes and/or state change logging

Thread schemes and state change reporting can be enabled using a property file, as described in the package description. Using a text editor, create a text file in a convenient location. Here is an example:

For scheme use engine, model or entity (see the package description for an explanation of the different schemes).

To pass these properties to the programs at run time, specify the property file location as the value of the jspasm.configuration system property. The value is expected to be a URL, so you must include a "file:" qualifier:

java -Djspasm.configuration=file:jspasm.props -cp jspasm-1-0-bin.jar:jspasmdemo-1-0-src.jar com.codexombie.jspasmdemo.PushButtonDemo

Note: Enabling state change logging is not advised when running the Benchmark program - it will attempt to report state changes for 2,000,000 events. Since console output is buffered in memory this will almost certainly cause an out-of-memory condition. Comment out or remove the jspasm.statechange.handler key in the property file when running the benchmark program.