jPOS 1.6.1 API Documentation

org.jpos.space
Class TSpace

java.lang.Object
  extended by java.util.TimerTask
      extended by org.jpos.space.TSpace
All Implemented Interfaces:
java.lang.Runnable, LocalSpace, Space, Loggeable

public class TSpace
extends java.util.TimerTask
implements LocalSpace, Loggeable

TSpace implementation

Since:
!.4.9
Version:
$Revision: 2594 $ $Date: 2008-01-22 08:41:31 -0800 (Tue, 22 Jan 2008) $
Author:
Alejandro Revilla

Field Summary
static long GCDELAY
           
 
Constructor Summary
TSpace()
           
 
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.
 void dump(java.io.PrintStream p, java.lang.String indent)
           
 void gc()
           
 java.lang.String getKeysAsString()
           
 java.util.Set getKeySet()
           
 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.
 boolean isEmpty()
           
 void notifyListeners(java.lang.Object key, java.lang.Object value)
           
 void out(java.lang.Object key, java.lang.Object value)
          Write a new entry into the Space
 void out(java.lang.Object key, java.lang.Object value, long timeout)
          Write a new entry into the Space, with an timeout value
 void push(java.lang.Object key, java.lang.Object value)
          Write a new entry at the head of a queue.
 void push(java.lang.Object key, 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.
 void removeListener(java.lang.Object key, SpaceListener listener)
          removes a SpaceListener associated with a given key
 void run()
           
 int size(java.lang.Object key)
           
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GCDELAY

public static final long GCDELAY
See Also:
Constant Field Values
Constructor Detail

TSpace

public TSpace()
Method Detail

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 key,
                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:
key - Entry's key
value - Object value
timeout - timeout value

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

run

public void run()
Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask

gc

public void gc()

size

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

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

isEmpty

public boolean isEmpty()

getKeySet

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

getKeysAsString

public java.lang.String getKeysAsString()

dump

public void dump(java.io.PrintStream p,
                 java.lang.String indent)
Specified by:
dump in interface Loggeable

notifyListeners

public void notifyListeners(java.lang.Object key,
                            java.lang.Object value)

push

public void push(java.lang.Object key,
                 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:
key - Entry's key
value - Object value

push

public void push(java.lang.Object key,
                 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:
key - Entry's key
value - Object value
timeout - timeout value

jPOS.org