jPOS 1.6.5 API Documentation

org.jpos.space
Class PersistentSpace

java.lang.Object
  extended by org.jpos.space.PersistentSpace
All Implemented Interfaces:
LocalSpace, Space

public class PersistentSpace
extends java.lang.Object
implements LocalSpace

Persistent Space implementation

Since:
2.0
Version:
$Revision: 2777 $ $Date: 2009-09-18 19:27:08 -0700 (Fri, 18 Sep 2009) $
Author:
Alejandro Revilla, modified by Kris Leite for Persistent

Constructor Summary
PersistentSpace()
           
 
Method Summary
 void addListener(java.lang.Object key, SpaceListener listener)
          add a SpaceListener associated with a given key
 void addListener(java.lang.Object key, SpaceListener listener, long timeout)
          add a SpaceListener associated with a given key for a given period of time.
 boolean existAny(java.lang.Object[] keys)
           
 boolean existAny(java.lang.Object[] keys, long timeout)
           
 java.lang.String getKeys()
           
 java.util.Set getKeySet()
           
static LocalSpace getSpace()
           
static LocalSpace getSpace(java.lang.String spaceName)
           
 java.lang.Object in(java.lang.Object key)
          Take an entry from the space, waiting forever until one exists.
 java.lang.Object in(java.lang.Object key, long timeout)
          Take an entry from the space, waiting a limited amount of time until one exists.
 java.lang.Object inp(java.lang.Object key)
          In probe takes an entry from the space if one exists, return null otherwise.
 void out(java.lang.Object key, java.lang.Object value)
          Write a new entry into the Space
 void out(java.lang.Object id, java.lang.Object value, long timeout)
          Write a new entry into the Space, with an timeout value
 void push(java.lang.Object id, java.lang.Object value)
          Write a new entry at the head of a queue.
 void push(java.lang.Object id, java.lang.Object value, long timeout)
          Write a new entry at the head of the queue with a timeout value
 java.lang.Object rd(java.lang.Object key)
          Read an entry from the space, waiting forever until one exists.
 java.lang.Object rd(java.lang.Object key, long timeout)
          Read an entry from the space, waiting a limited amount of time until one exists.
 java.lang.Object rdp(java.lang.Object key)
          Read probe reads an entry from the space if one exists, return null otherwise.
 java.lang.String read(java.lang.String key)
           
 void removeListener(java.lang.Object key, SpaceListener listener)
          removes a SpaceListener associated with a given key
 void setCacheSize(int cacheSize)
           
 int size(java.lang.Object key)
           
 void write(java.lang.String key, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentSpace

public PersistentSpace()
Method Detail

setCacheSize

public void setCacheSize(int cacheSize)

out

public void out(java.lang.Object key,
                java.lang.Object value)
Description copied from interface: Space
Write a new entry into the Space

Specified by:
out in interface Space
Parameters:
key - Entry's key
value - Object value

out

public void out(java.lang.Object id,
                java.lang.Object value,
                long timeout)
Description copied from interface: Space
Write a new entry into the Space, with an timeout value

Specified by:
out in interface Space
Parameters:
id - Entry's key
value - Object value
timeout - timeout value

size

public int size(java.lang.Object key)
Specified by:
size in interface LocalSpace
Returns:
number of entries in a given key

rdp

public java.lang.Object rdp(java.lang.Object key)
Description copied from interface: Space
Read probe reads an entry from the space if one exists, return null otherwise.

Specified by:
rdp in interface Space
Parameters:
key - Entry's key
Returns:
value or null

inp

public java.lang.Object inp(java.lang.Object key)
Description copied from interface: Space
In probe takes an entry from the space if one exists, return null otherwise.

Specified by:
inp in interface Space
Parameters:
key - Entry's key
Returns:
value or null

in

public java.lang.Object in(java.lang.Object key)
Description copied from interface: Space
Take an entry from the space, waiting forever until one exists.

Specified by:
in in interface Space
Parameters:
key - Entry's key
Returns:
value

in

public java.lang.Object in(java.lang.Object key,
                           long timeout)
Description copied from interface: Space
Take an entry from the space, waiting a limited amount of time until one exists.

Specified by:
in in interface Space
Parameters:
key - Entry's key
timeout - millis to wait
Returns:
value or null

rd

public java.lang.Object rd(java.lang.Object key)
Description copied from interface: Space
Read an entry from the space, waiting forever until one exists.

Specified by:
rd in interface Space
Parameters:
key - Entry's key
Returns:
value

rd

public java.lang.Object rd(java.lang.Object key,
                           long timeout)
Description copied from interface: Space
Read an entry from the space, waiting a limited amount of time until one exists.

Specified by:
rd in interface Space
Parameters:
key - Entry's key
timeout - millis to wait
Returns:
value or null

addListener

public void addListener(java.lang.Object key,
                        SpaceListener listener)
Description copied from interface: LocalSpace
add a SpaceListener associated with a given key

Specified by:
addListener in interface LocalSpace
Parameters:
key - Entry's key
listener - a SpaceListener

addListener

public void addListener(java.lang.Object key,
                        SpaceListener listener,
                        long timeout)
Description copied from interface: LocalSpace
add a SpaceListener associated with a given key for a given period of time. Warning: not supported by all space implementations.

Specified by:
addListener in interface LocalSpace
Parameters:
key - Entry's key
listener - a SpaceListener

removeListener

public void removeListener(java.lang.Object key,
                           SpaceListener listener)
Description copied from interface: LocalSpace
removes a SpaceListener associated with a given key

Specified by:
removeListener in interface LocalSpace
Parameters:
key - Entry's key
listener - the SpaceListener

getSpace

public static final LocalSpace getSpace()

getSpace

public static final LocalSpace getSpace(java.lang.String spaceName)

getKeySet

public java.util.Set getKeySet()
Specified by:
getKeySet in interface LocalSpace
Returns:
Set containing all keys in Space

getKeys

public java.lang.String getKeys()

write

public void write(java.lang.String key,
                  java.lang.String value)

read

public java.lang.String read(java.lang.String key)

push

public void push(java.lang.Object id,
                 java.lang.Object value)
Description copied from interface: Space
Write a new entry at the head of a queue.

Specified by:
push in interface Space
Parameters:
id - Entry's key
value - Object value

push

public void push(java.lang.Object id,
                 java.lang.Object value,
                 long timeout)
Description copied from interface: Space
Write a new entry at the head of the queue with a timeout value

Specified by:
push in interface Space
Parameters:
id - Entry's key
value - Object value
timeout - timeout value

existAny

public boolean existAny(java.lang.Object[] keys)
Specified by:
existAny in interface Space
Parameters:
keys - array of keys to check
Returns:
true if one or more keys are available in the space

existAny

public boolean existAny(java.lang.Object[] keys,
                        long timeout)
Specified by:
existAny in interface Space
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

jPOS.org