SALSA: Getting Started

Part 1: setup the environment variable

First at all, you have to setup your environment (bash) by typing the following command. SALSA does not support dynamic code downloading, and thus you must be very carefully dealing with the path of your classes.

export CLASSPATH=/projects/dci/salsa/salsa070.jar:.:$CLASSPATH

There are several salsa example files in the directory "/projects/dci/Salsa/src/examples". Take a look at them.


Part 2: the example code

The example we are going to show you is "Migrate.salsa". We will show you the source code first, and then tell you how to compile it, start the theater, and run the main program. The source code is listed below:


behavior Migrate {
String myName;

/* the constructor */
Migrate (String givenName) {

public void running(String target) {
standardOutput<-println(myName+": I am here") @

public void back() {
standardOutput<-println(myName+": Now I am here after migration.") @
standardOutput<-println("currentContinuation test");

/* the main function */
public void act(String[] args){
try {
Migrate a = new Migrate(args[0]) at (new UAN(args[1]), null);
} catch (ArrayIndexOutOfBoundsException e) {
standardOutput<-println("Usage: java Migrate <String> <UAN> <UAL>");
} catch (MalformedUANException e) {
standardError<-println("Error creating UAN: " + e);

Notice that "standardError" and "standardOutput are special actors that every actor can send messages to it. In this example, the actor "a" receives three arguments. The first one is a string, the second is its universal name, and the third is the RMSP address of the migration destination.


Part 3: compile Migrate.salsa
    java salsac.SalsaCompiler Migrate.salsa


Part 4: start the name server
Let's assume we want to start the server at The default port number is 3030.

    java wwc.naming.WWCNamingServer


Part 5: start the remote theater
We start the theater at by typing
    java wwc.messaging.Theater 5050 

Notice that your compiled java class files must in the current directoy if you had set CLASSPATH shown in part 1. Otherwise you have to set CLASSPATH correctly.


Part 6: run the main program at any machine:

     java Migrate Jason uan:// rmsp://

Remember to set the environment variable CLASSPTH shown in the part 1 before running the program.