This example provides a simple demonstration of how to use a JavaSpace (it is not Blitz specific).
The example consists of four classes:
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:
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.
For more examples see:
For JavaSpaces resources see here