Skip to end of metadata
Go to start of metadata

Blitz HelloWorld Example

Introduction

This example provides a simple demonstration of how to use a JavaSpace (it is not Blitz specific).
Compiling
The example consists of four classes:

1. Lookup.java which handles service lookup.
2. Writer.java which generates Entry's.
3. Taker.java which takes Entry's.
4. TestEntry.java which is the Entry class.

In order to compile these classes you will require the following .jar's:

  • jsk-lib.jar, jsk-platform.jar from the JINI 2.x distribution.

Assuming that your JINI 2.1 distribution is in /jini2_1 and your Blitz distribution is in /blitz, you can compile the example as follows:

Running

Before starting the example, ensure that you have a Blitz instance running in a public lookup group - see the Installation Guide. This is necessary because the Lookup class does a single lookup and discover step - it does not register with discovered lookup services. Thus, if a Blitz instance isn't registered beforehand, it will not be found (I'll fix this in a future release!).

We are now ready to run the example. First, we'll start the taker - open a new terminal window and then:

Now we'll run the Writer - open a new terminal window and then:

The Taker will exit automatically when it hasn't taken an Entry in the last 60 seconds.

More Material

For more examples see:

1. JavaSpaces in Practice Examples
2. Bodega Project

For JavaSpaces resources see here

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.