Skip to main content

LocalSpace interface

The Space interface is structured to facilitate easy implementation in various contexts, including persistent spaces, remote spaces, and replicated spaces.

For cases where the implementation operates within a single JVM, the LocalSpace interface extends the functionality of the Space interface. This is exemplified in the TSpace implementation.

The additional methods include:

public interface LocalSpace {
public void addListener (Object key, SpaceListener listener);
public void addListener (Object key, SpaceListener listener, long timeout);
public void removeListener (Object key, SpaceListener listener);
}

as well as some miscellaneous methods that could be expensive to transmit over the wire and were left out in the base Space implementation.

    public Set getKeySet ();
public int size (Object key);

The SpaceListener implementation looks like this:

public interface SpaceListener {
public void notify (Object key, Object value);
}
note

With the +LocalSpace+ we can create event-driven consumers that allows us to reduce the number of threads. A good example is the thread-less lightweight QMUX implementation.