Chapter 8. Distributed Events

If a listener nods his head when you're explaining your program, wake him up.

—Alan Perlis, Epigrams in Programming

The read and take methods encourage a programming style whereby we explicitly read (or take) entries from a space, blocking if no such entry is yet available. Until now, we've ignored the JavaSpace interface's notify method, which allows us to react to the arrival of entries as they are placed in a space. Although notify won't allow you to write programs that can't already be written in terms of reads and takes, notify will provide you with another tool that can be used if your application is simpler to design or build using a reactive programming style. In addition, notify can be used to allow non-space-based programs to react to the arrival of entries in a space.

In this chapter you will first learn about the distributed event model—how it differs from the standard Java programming language event model and what guarantees can be made of events in the distributed environment. We will then take a look at a simple example that uses notify, and we will introduce the various classes and interfaces that come into play. By the end of this chapter you should have a grasp on how distributed events can be used with space-based programs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset