public interface Space<K,V>
Space uses concepts described in the Linda Coordination Language that eases the implementation of other jPOS components (such as Channels, Muxes, etc.), but it is not by any means an attempt to provide a full implementation.
jPOS's Space is basically a Map where each entry is a LinkedList of values that can be used as a BlockingQueue
One can place entries on a queue by calling Space.out, take them by calling Space.in and read (without taking) by calling Space.rd
TSpace
,
SpaceError
,
The Linda Coordination LanguageModifier and Type | Method and Description |
---|---|
boolean |
existAny(K[] keys) |
boolean |
existAny(K[] keys,
long timeout) |
V |
in(K key)
Take an entry from the space, waiting forever until one exists.
|
V |
in(K key,
long timeout)
Take an entry from the space, waiting a limited amount of time
until one exists.
|
V |
inp(K key)
In probe takes an entry from the space if one exists,
return null otherwise.
|
void |
nrd(K key)
Nrd (not read) waits forever until Key is not present in space
Resolution for expiring entries is implementation dependant, but a minimum one-second is suggested.
|
V |
nrd(K key,
long timeout)
Nrd (not read) waits up to timeout until Key is not present in space
Resolution for expiring entries is implementation dependant, but a minimum one-second is suggested.
|
void |
out(K key,
V value)
Write a new entry into the Space
|
void |
out(K key,
V value,
long timeout)
Write a new entry into the Space, with an timeout value
|
void |
push(K key,
V value)
Write a new entry at the head of a queue.
|
void |
push(K key,
V value,
long timeout)
Write a new entry at the head of the queue with a timeout value
|
void |
put(K key,
V value)
Write a single entry at the head of the queue discarding the other entries
|
void |
put(K key,
V value,
long timeout)
Write a single entry at the head of the queue discarding the other entries, with timeout.
|
V |
rd(K key)
Read an entry from the space, waiting forever until one exists.
|
V |
rd(K key,
long timeout)
Read an entry from the space, waiting a limited amount of time
until one exists.
|
V |
rdp(K key)
Read probe reads an entry from the space if one exists,
return null otherwise.
|
void out(K key, V value)
key
- Entry's keyvalue
- Object valuevoid out(K key, V value, long timeout)
key
- Entry's keyvalue
- Object valuetimeout
- timeout value in millisV in(K key)
key
- Entry's keyV rd(K key)
key
- Entry's keyV in(K key, long timeout)
key
- Entry's keytimeout
- millis to waitV rd(K key, long timeout)
key
- Entry's keytimeout
- millis to waitV inp(K key)
key
- Entry's keyV rdp(K key)
key
- Entry's keyvoid nrd(K key)
key
- Entry's keyV nrd(K key, long timeout)
key
- Entry's keytimeout
- millis to waitvoid push(K key, V value)
key
- Entry's keyvalue
- Object valuevoid push(K key, V value, long timeout)
key
- Entry's keyvalue
- Object valuetimeout
- timeout value in millisboolean existAny(K[] keys)
keys
- array of keys to checkboolean existAny(K[] keys, long timeout)
keys
- array of keys to checktimeout
- to wait for any of the entries to become available in millisvoid put(K key, V value)
key
- Entry's keyvalue
- Object value