jPOS 1.6.7 API Documentation

org.jpos.space
Class JESpace<K,V>

java.lang.Object
  extended by org.jpos.util.Log
      extended by org.jpos.space.JESpace<K,V>
All Implemented Interfaces:
Space<K,V>, LogSource

public class JESpace<K,V>
extends Log
implements Space<K,V>

BerkeleyDB Jave Edition based persistent space implementation

Since:
1.6.5
Author:
Alejandro Revilla

Nested Class Summary
static class JESpace.GCRef
           
static class JESpace.Ref
           
 
Field Summary
static long GC_DELAY
           
 
Fields inherited from class org.jpos.util.Log
DEBUG, ERROR, FATAL, INFO, TRACE, WARN
 
Constructor Summary
JESpace(java.lang.String name, java.lang.String path)
           
 
Method Summary
 void close()
           
 boolean existAny(java.lang.Object[] keys)
           
 boolean existAny(java.lang.Object[] keys, long timeout)
           
 void gc()
           
static JESpace getSpace(java.lang.String name)
           
static JESpace getSpace(java.lang.String name, java.lang.String path)
           
 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.
 void scheduleGC()
           
 
Methods inherited from class org.jpos.util.Log
createDebug, createDebug, createError, createError, createFatal, createFatal, createInfo, createInfo, createLogEvent, createLogEvent, createTrace, createTrace, createWarn, createWarn, debug, debug, error, error, fatal, fatal, getLog, getLogger, getRealm, info, info, setLogger, setLogger, setRealm, trace, trace, warn, warn
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GC_DELAY

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

JESpace

public JESpace(java.lang.String name,
               java.lang.String path)
        throws SpaceError
Throws:
SpaceError
Method Detail

out

public void out(K key,
                V value)
Description copied from interface: Space
Write a new entry into the Space

Specified by:
out in interface Space<K,V>
Parameters:
key - Entry's key
value - Object value

out

public void out(K key,
                V 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<K,V>
Parameters:
key - Entry's key
value - Object value
timeout - timeout value

push

public void push(K key,
                 V 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<K,V>
Parameters:
key - Entry's key
value - Object value
timeout - timeout value

push

public void push(K key,
                 V value)
Description copied from interface: Space
Write a new entry at the head of a queue.

Specified by:
push in interface Space<K,V>
Parameters:
key - Entry's key
value - Object value

rdp

public V 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<K,V>
Parameters:
key - Entry's key
Returns:
value or null

in

public V 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<K,V>
Parameters:
key - Entry's key
Returns:
value

in

public V 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<K,V>
Parameters:
key - Entry's key
timeout - millis to wait
Returns:
value or null

rd

public V 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<K,V>
Parameters:
key - Entry's key
Returns:
value

rd

public V 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<K,V>
Parameters:
key - Entry's key
timeout - millis to wait
Returns:
value or null

inp

public V 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<K,V>
Parameters:
key - Entry's key
Returns:
value or null

existAny

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

public void put(K key,
                V value,
                long timeout)
Description copied from interface: Space
Write a single entry at the head of the queue discarding the other entries, with timeout.

Specified by:
put in interface Space<K,V>
Parameters:
key - Entry's key
value - Object value
timeout - timeout value

put

public void put(K key,
                V value)
Description copied from interface: Space
Write a single entry at the head of the queue discarding the other entries

Specified by:
put in interface Space<K,V>
Parameters:
key - Entry's key
value - Object value

gc

public void gc()
        throws com.sleepycat.je.DatabaseException
Throws:
com.sleepycat.je.DatabaseException

scheduleGC

public void scheduleGC()

close

public void close()
           throws com.sleepycat.je.DatabaseException
Throws:
com.sleepycat.je.DatabaseException

getSpace

public static JESpace getSpace(java.lang.String name,
                               java.lang.String path)

getSpace

public static JESpace getSpace(java.lang.String name)

jPOS.org