Using JavaSpaces in Orc#

JavaSpaces is Sun's distributed tuple space service. JavaSpaces is now part of Apache River.

This page supplies a simple example of using JavaSpaces in Orc, based the SDN article Getting Started With JavaSpaces Technology: Beyond Conventional Distributed Programming Paradigms by Q. H. Mamoud.

Installing Apache River#

  1. Download the Apache River binary release from URL:
  2. Expand the downloaded ZIP/GZIP file into a directory, which we will refer to hereinafter as ${RIVER_HOME} .

Installing the example#

  1. Download two utility classes from the JavaSpaces article: and
  2. Compile them: javac -classpath ${RIVER_HOME}/lib/jini-ext.jar
  3. Download the Orc program SpaceClient.orc(info)
  4. Download a temporary fix needed until Orc issue 84 is fixed:
  5. Compile with: javac -classpath ${RIVER_HOME}/lib/jini-ext.jar

The Orc program#

Contents of SpaceClient.orc(info):

-- Translation into Orc of from
-- Mamoud, Q. H. 2005. Getting Started With JavaSpaces Technology: Beyond
-- Conventional Distributed Programming Paradigms. Sun Developer Network.

import class MessageEntry = "MessageEntry"
import class Lookup = "Lookup"
import class Class = "java.lang.Class"
import class Long = "java.lang.Long"
import class JavaSpace = ""

MessageEntry() >msg>
msg.content := "Hello there" >>
Println("Searching for a JavaSpace...") >>
Lookup(Class.forName("")) >finder>
finder.getService() >space>
Println("A JavaSpace has been discovered. ") >>
Println("Writing a message into the space...") >>
space.write(msg, null, 60*60*1000) >>
MessageEntry() >template>
Println("Reading a message from the space...") >>, null, Long.MAX_VALUE?) >result>
Println("The message read is: "+result.content?)

Running Apache River JavaSpaces#

Open three shells and run each of the following, one per shell:

cd ${RIVER_HOME}/examples/hello
cd ${RIVER_HOME}/examples/hello
cd ${RIVER_HOME}/examples/hello
java -jar ../../lib/start.jar config/start-outrigger-group.config

Running the Orc program#

In the directory with the SpaceClient.orc and the compiled MessageEntry and Lookup classfiles, run the Orc example:

java -cp ${ORC_HOME}/orc-2.0.2.jar:${ORC_HOME}/lib/\*:${RIVER_HOME}/lib/jini-ext.jar:${RIVER_HOME}/lib/reggie.jar:${RIVER_HOME}/lib/outrigger.jar:. orc.Main SpaceClient.orc

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
java 4.7 kB 1 26-Aug-2011 12:57 JohnThywissen
java 0.3 kB 1 26-Aug-2011 12:57 JohnThywissen
SpaceClient.orc 1.0 kB 1 26-Aug-2011 12:58 JohnThywissen
java 0.8 kB 1 26-Aug-2011 13:06 JohnThywissen
« This page (revision-9) was last changed on 26-Aug-2011 13:09 by JohnThywissen