3.2. Shared Variables
One of the most common data structures in space-based distributed programming is the shared variable. A space-based shared variable is the simplest of distributed data structures, since it is made up of a single entry. Like any variable, a shared variable provides storage for some value or object; however, a space-based shared variable allows multiple processes to easily access and modify its value in an atomic manner. We will return to the topic of atomic modification shortly, but let's first build a space-based shared variable.
Here is a definition of a simple shared variable:
public class SharedVar implements Entry { public String name; public Integer value; public SharedVar() { } public SharedVar(String name) { this.name ...
Get JavaSpaces™ Principles, Patterns, and Practice now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.