jPOS 1.6.7 API Documentation

org.jpos.space
Interface Space<K,V>

All Known Subinterfaces:
LocalSpace<K,V>
All Known Implementing Classes:
JDBMSpace, JESpace, PersistentSpace, Request, SpaceInterceptor, SpaceLet, TinySpace, TransientSpace, TSpace

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

Since:
2.0
Version:
$Revision: 2858 $ $Date: 2010-01-05 07:49:19 -0800 (Tue, 05 Jan 2010) $
Author:
Alejandro Revilla
See Also:
LeasedReference, TransientSpace, SpaceError, The Linda Coordination Language

Method Summary
 boolean existAny(K[] keys)
           
 boolean existAny(K[] keys, long timeout)
           
 V in(java.lang.Object key)
          Take an entry from the space, waiting forever until one exists.
 V in(java.lang.Object key, long timeout)
          Take an entry from the space, waiting a limited amount of time until one exists.
 V inp(java.lang.Object key)
          In probe takes an entry from the space if one exists, return null otherwise.
 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(java.lang.Object key)
          Read an entry from the space, waiting forever until one exists.
 V rd(java.lang.Object key, long timeout)
          Read an entry from the space, waiting a limited amount of time until one exists.
 V rdp(java.lang.Object key)
          Read probe reads an entry from the space if one exists, return null otherwise.
 

Method Detail

out

void out(K key,
         V value)
Write a new entry into the Space

Parameters:
key - Entry's key
value - Object value

out

void out(K key,
         V value,
         long timeout)
Write a new entry into the Space, with an timeout value

Parameters:
key - Entry's key
value - Object value
timeout - timeout value

in

V in(java.lang.Object key)
Take an entry from the space, waiting forever until one exists.

Parameters:
key - Entry's key
Returns:
value

rd

V rd(java.lang.Object key)
Read an entry from the space, waiting forever until one exists.

Parameters:
key - Entry's key
Returns:
value

in

V in(java.lang.Object key,
     long timeout)
Take an entry from the space, waiting a limited amount of time until one exists.

Parameters:
key - Entry's key
timeout - millis to wait
Returns:
value or null

rd

V rd(java.lang.Object key,
     long timeout)
Read an entry from the space, waiting a limited amount of time until one exists.

Parameters:
key - Entry's key
timeout - millis to wait
Returns:
value or null

inp

V inp(java.lang.Object key)
In probe takes an entry from the space if one exists, return null otherwise.

Parameters:
key - Entry's key
Returns:
value or null

rdp

V rdp(java.lang.Object key)
Read probe reads an entry from the space if one exists, return null otherwise.

Parameters:
key - Entry's key
Returns:
value or null

push

void push(K key,
          V value)
Write a new entry at the head of a queue.

Parameters:
key - Entry's key
value - Object value

push

void push(K key,
          V value,
          long timeout)
Write a new entry at the head of the queue with a timeout value

Parameters:
key - Entry's key
value - Object value
timeout - timeout value

existAny

boolean existAny(K[] keys)
Parameters:
keys - array of keys to check
Returns:
true if one or more keys are available in the space

existAny

boolean existAny(K[] keys,
                 long timeout)
Parameters:
keys - array of keys to check
timeout - to wait for any of the entries to become available
Returns:
true if one or more keys are available in the space

put

void put(K key,
         V value)
Write a single entry at the head of the queue discarding the other entries

Parameters:
key - Entry's key
value - Object value

put

void put(K key,
         V value,
         long timeout)
Write a single entry at the head of the queue discarding the other entries, with timeout.

Parameters:
key - Entry's key
value - Object value
timeout - timeout value

jPOS.org